We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

SL Google Map Field Type : Google Maps in your CP, SAEFs, and EE templates : Now with map types in the CP

Development and Programming

Versa Studio's avatar
Versa Studio
572 posts
16 years ago
Versa Studio's avatar Versa Studio

Hey all, I think I solved my problem. Here’s how I generate Google map links with custom pin locations, using the SL Google Map Extension.

  • Use custom fields for address, city, state, zip.
  • Create links with this form:
http://maps.google.com/maps?q=(Crestview Apartments)+1001 North Pleasant [email protected],-72.53328323364258&zoom=16

According to the Wiki article cited earlier: http://mapki.com/wiki/Google_Map_Parameters * Putting parentheses around something in the query (q=…) makes it show up in the browser title bar and elsewhere. * Using the @ sign followed by {pin_lat},{pin_lng} allows you to create arbitrary pin locations. Why is this important? Because sometimes Google maps are WRONG. My client noticed that some of their apartments were showing up blocks away from where they are physically located.

I may write an article on this for EE Developer. If so, I will post back.

       
Versa Studio's avatar
Versa Studio
572 posts
16 years ago
Versa Studio's avatar Versa Studio

I’ve posted an article detailing how to do this.

http://ee-developer.com/home/articles/creating-custom-google-maps-in-expressionengine-entries/

       
Stephen Lewis's avatar
Stephen Lewis
466 posts
16 years ago
Stephen Lewis's avatar Stephen Lewis

Interesting stuff, thanks for putting together the article expdesign.

It’s annoying that the Google Map locations are occasionally wide of the mark. It’s a known issue on the UK maps when searching for a postcode, because Google doesn’t have full access to the UK postcode database, but thankfully I was able to implement a decent workaround.

Anyway, I’m glad you finally got everything sorted.

Cheers, Stephen

       
Versa Studio's avatar
Versa Studio
572 posts
16 years ago
Versa Studio's avatar Versa Studio

Stephen,

You’re welcome to link to the article and/or add comments or clarification. You can even write one and be credited, if you like.

       
j0han's avatar
j0han
20 posts
16 years ago
j0han's avatar j0han

For some strange reason, the {google-map} tag doesn’t get parsed in my template. The map shows up fine in the Control Panel though. I don’t see what I’m doing wrong. Anyone have a clue?

       
Stephen Lewis's avatar
Stephen Lewis
466 posts
16 years ago
Stephen Lewis's avatar Stephen Lewis
For some strange reason, the {google-map} tag doesn’t get parsed in my template. The map shows up fine in the Control Panel though. I don’t see what I’m doing wrong. Anyone have a clue?

Can you post the relevant part of your template code please Johan?

Cheers, Stephen

       
j0han's avatar
j0han
20 posts
16 years ago
j0han's avatar j0han
{google-map}

{locatie-wereld-beluister}
This is the fallback content for users who cannot see the Google Map.
The current latitude and longitude of your map is {map_lat} and {map_lng}, respectively. The zoom-level is {map_zoom}.
The current latitude and longitude of your pin is {pin_lat} and {pin_lng}, respectively.
{/locatie-wereld-beluister}
    

{/google-map}
       
Stephen Lewis's avatar
Stephen Lewis
466 posts
16 years ago
Stephen Lewis's avatar Stephen Lewis

What’s the name of the SL Google Map field Johan?

Stephen

       
j0han's avatar
j0han
20 posts
16 years ago
j0han's avatar j0han

Hi Stephen,

{locatie-wereld-beluister} is the map field

       
Stephen Lewis's avatar
Stephen Lewis
466 posts
16 years ago
Stephen Lewis's avatar Stephen Lewis

Hi Johan,

{locatie-wereld-beluister} is the map field

As per the docs, the code you need is something like this:

{exp:weblog:entries weblog="your-weblog-name"}
{locatie-wereld-beluister id="example-map" class="map" controls="zoom|scale|overview" map="drag|click_zoom|scroll_zoom" pin="drag|center"}
{map}
This is the fallback content for users who cannot see the Google Map.

The current latitude and longitude of your map is {map_lat} and {map_lng}, respectively. The zoom-level is {map_zoom}.

The current latitude and longitude of your pin is {pin_lat} and {pin_lng}, respectively.
{/map}
{/locatie-wereld-beluister}
{/exp:weblog:entries}

Hope that clarifies matter.

Cheers, Stephen

       
j0han's avatar
j0han
20 posts
16 years ago
j0han's avatar j0han

That does the trick. Thanks a lot Stephen!

       
Stephen Lewis's avatar
Stephen Lewis
466 posts
16 years ago
Stephen Lewis's avatar Stephen Lewis
That does the trick. Thanks a lot Stephen!

No problem Johan, glad you got it sorted.

Cheers, Stephen

       
stinhambo's avatar
stinhambo
1,268 posts
16 years ago
stinhambo's avatar stinhambo

Hi Stephen,

Some thoughts now I’ve used it -

  • Ability to choose localised Google Maps such as http://maps.google.com.au. Perhaps this will improve performance? Ignore if this isn’t the case.
  • Ability to place a pin by another method. If I look around the map I have to find the pin and drag it.
  • Satellite, Hybrid and Terrain outputs (in the CP)?
  • Street View output?
       
stinhambo's avatar
stinhambo
1,268 posts
16 years ago
stinhambo's avatar stinhambo

Is there a way to use multiple maps on one page? I try to do this -

{franchise_googlemap id="map_{entry_id}" class="googlemap" controls="zoom|scale|overview" map="drag|click_zoom|scroll_zoom" pin="drag|center"}

But the output comes out like this -

<div id="field_id_42_container" class="sl-google-map">" class="googlemap" controls="zoom|scale|overview" map="drag|click_zoom|scroll_zoom" pin="drag|center"}

I’m also getting the following errors at the top of the template -

Notice: Undefined offset: 4 in /home/tuscan/public_html/tennisexcellence/admin/extensions/fieldtypes/sl_google_map/ft.sl_google_map.php on line 464

Notice: Undefined offset: 3 in /home/tuscan/public_html/tennisexcellence/admin/extensions/fieldtypes/sl_google_map/ft.sl_google_map.php on line 464

Notice: Undefined offset: 2 in /home/tuscan/public_html/tennisexcellence/admin/extensions/fieldtypes/sl_google_map/ft.sl_google_map.php on line 464

Notice: Undefined offset: 1 in /home/tuscan/public_html/tennisexcellence/admin/extensions/fieldtypes/sl_google_map/ft.sl_google_map.php on line 464
       
Stephen Lewis's avatar
Stephen Lewis
466 posts
16 years ago
Stephen Lewis's avatar Stephen Lewis

Hi Steven,

Apologies for the delay in responding to this, work is very busy at the moment.

Is there a way to use multiple maps on one page? I try to do this…

This is probably a parse-order problem. Placing the Google Map in an embedded template, and passing in the ID, would be a better bet.

As to the other template errors, let me know if they don’t go away once the other problem is addressed, and I’ll look into it.

Also, thanks for the suggestions. You’re not the first person to mention support for localised servers, so I’ll have to find out what (if any) difference that would make.

Cheers, Stephen

       
First 4 5 6 7 8 Last

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.