Answers.Body: <p>Found the solution, posting answer for future reference:</p>
  
  <p>It seems the official docs provide a wrong example for outputting the parts. Instead of using <code>{{ myMapField.country_short }}</code> as mentioned in the docs, you have to use <code>{{ myMapField.parts.country_short }}</code> (or without the _short suffix). This will correctly output just the country part of the full address.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-14T12:05:34.020Z
Answers.LastActivityDate: 2017-04-14T12:05:34.020Z
Answers.UserDisplayName: Jake
Answers.Body: <p>Never used the plugin, but from the docs:</p>
  <blockquote>
  <p><strong>parts</strong></p>
  <p>This contains the locations address, broken down into its constituent parts. All values are optional so you'll need to have checks on any you use to make sure they exist.
  A list of the available values can be found here.
  To access the short version of any part, append _short to the end of its name. E.g. {{ myMapField.country_short }}.</p>
  </blockquote>
  <p>Sounds like the country info is optional and may not exist on the model, hence the note to check if it exists or not first.</p>
  <p>i.e.</p>
  <pre><code>{% if myMapField.country_short is defined %}
      {{ myMapField.country_short }}
  {% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-05T08:04:26.423Z
Answers.Text: Thank you, unfortunately it does not solve the error. For the record the values I use are actually `{{ entry.myMapField }} {{ entry.myMapField.address }} {{ entry.myMapField.lat }}` etc. (in a for loop). Any other ideas?
Answers.UserDisplayName: Jake
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-05-06T07:40:10.647Z
Answers.Text: Jake please let me know if you got this figured out yet, I am running into the same.
Answers.UserDisplayName: Vin
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-04T18:44:25.963Z
Answers.LastActivityDate: 2017-04-04T18:44:25.963Z
Answers.LastEditDate: 2020-06-17T08:56:27.903Z
Answers.UserDisplayName: Brad Bell
Body: <p>The docs of the <a href="https://github.com/ethercreative/simplemap" rel="nofollow noreferrer">SimpleMap</a> plugin mention it's possible to output only part of the full location, e.g. just the country by using </p>
  
  <pre><code>{{ myMapField.country_short }}
  </code></pre>
  
  <p>but in my project I get this error when I try doing so:</p>
  
  <pre><code>Internal Server Error
  
  Craft\SimpleMap_MapModel and its behaviors do not have a method or closure named "country".
  </code></pre>
  
  <p>Same result without the _short suffix.
  The plugin is set up properly as I can correctly output full address, lat, lng, zoom values like so:</p>
  
  <pre><code>{{ myMapField.address }}
  {{ myMapField.lat }}
  {{ myMapField.lng }}
  </code></pre>
  
  <p>Just splitting up the full address results in the above error. What's going wrong?</p>
  
Tags: <plugin-simplemap>
Title: How do I output only country part of location field using the SimpleMap plugin?
ThreadText: # How do I output only country part of location field using the SimpleMap plugin?
  
  (Asked by: username_0 on 2017-04-04)
  
  The docs of the [SimpleMap](https://github.com/ethercreative/simplemap) plugin mention it's possible to output only part of the full location, e.g. just the country by using
  
  ```
  {{ myMapField.country_short }}
  
  ```
  
  but in my project I get this error when I try doing so:
  
  ```
  Internal Server Error
  
  Craft\SimpleMap_MapModel and its behaviors do not have a method or closure named "country".
  
  ```
  
  Same result without the \_short suffix.
  The plugin is set up properly as I can correctly output full address, lat, lng, zoom values like so:
  
  ```
  {{ myMapField.address }}
  {{ myMapField.lat }}
  {{ myMapField.lng }}
  
  ```
  
  Just splitting up the full address results in the above error. What's going wrong?
  
  **Tags:** plugin-simplemap
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2017-04-14. Score: 1 | Accepted answer
  
  Found the solution, posting answer for future reference:
  
  It seems the official docs provide a wrong example for outputting the parts. Instead of using `{{ myMapField.country_short }}` as mentioned in the docs, you have to use `{{ myMapField.parts.country_short }}` (or without the \_short suffix). This will correctly output just the country part of the full address.
  
  
  ---
  
  ### Answer by username_1 on 2017-04-04. Score: 1
  
  Never used the plugin, but from the docs:
  
  > **parts**
  >
  > This contains the locations address, broken down into its constituent parts. All values are optional so you'll need to have checks on any you use to make sure they exist.
  > A list of the available values can be found here.
  > To access the short version of any part, append \_short to the end of its name. E.g. {{ myMapField.country\_short }}.
  
  Sounds like the country info is optional and may not exist on the model, hence the note to check if it exists or not first.
  
  i.e.
  
  ```
  {% if myMapField.country_short is defined %}
      {{ myMapField.country_short }}
  {% endif %}
  
  ```
  
  > **Comments:**
  > **username_0**: Thank you, unfortunately it does not solve the error. For the record the values I use are actually `{{ entry.myMapField }} {{ entry.myMapField.address }} {{ entry.myMapField.lat }}` etc. (in a for loop). Any other ideas?  
  > **username_2**: username_0 please let me know if you got this figured out yet, I am running into the same.  
  
  ---
  
  