How would you display only the country name from an entry that has been geocoded with the fieldtype from the excellent Google Maps for ExpressionEngine (GMEE)?

1 Answer 1


I have discovered two ways of doing this which I thought might be helpful to someone, and am looking for improvements or better ideas if people have them.

Method 1.

Use a javascript plugin, as suggested by Justin Kimbrell, author of Google Maps for ExpressionEngine.

Method 2.

Use the extremely versatile 'Low Replace' ExpressionEngine plugin by Lodewijk Schutte:

{exp:channel:entries etc}
  {geolocation parse="markers"}
      {exp:low_replace find="(.*,\s)(.*)" replace="$2" regex="yes"}


  • Non-essential code has been removed for brevity.
  • 'geolocation' is the name of a GMEE fieldtype custom field
  • The regex accounts for multiple place names in the format provided by Google Maps (e.g. "city, state, country" will be replaced by "country").
  • Tested on EE v2.5.5 and GMEE v3.1.0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.