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

goodcompany's avatar
goodcompany
51 posts
16 years ago
goodcompany's avatar goodcompany

I love this extension, it’s exactly what I’ve needed and been looking for.

I am having a small issue pulling out the pin location though. Using the following block of sample code…

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.

I get the following result.

The current latitude and longitude of your map is 40.74750080613109 and -74.00182485580444, respectively. The zoom-level is 16.

The current latitude and longitude of your pin is 40.74750080613109 and -74.00182485580444, respectively.

That is to say, the pin_lat/lng vars seem to be overwritten by those of the map. Curious as to why/how this could happen. Or maybe this is normal and to be expected for a centered map 😊

Also weird that when I try to build a link to the larger google map the pin doesn’t appear. Clicking on the google logo in the bottom left corner returns the same result - a large map with no pin. Maybe the maps API is having trouble today…

<a href="http://maps.google.com/maps?ll={map_lat},{map_lng}&spn={pin_lat},{pin_lng}&z={map_zoom}">View a larger map</a> or <a href="http://maps.google.com/maps?ll={map_lat},{map_lng}&spn={pin_lat},{pin_lng}&z={map_zoom}&pw=2">make a print of it.</a>
       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen
Actually I just checked out Korea in maps.google.com and then maps.google.co.kr and unless I’m doing something woefully wrong the map on maps.google.com gave me a much better zoom resolution than the other site?
I can’t speak to your experience, Mark. For us it’s the opposite – the .co.kr site gives us a detailed map, while the .com site gives us no detail at all.

That’s just weird. I wonder why that is though? Perhaps some sort of licensing issue in different countries or something. Seems rather weird though.

Anyway, I would think that the ability to choose the server would be of general interest to international, non-English speaking users. Spanish, French, and German-language speakers, for example, find maps more useful when labelled in their languages even if the detail level is exactly the same.

Yep totally understand that, makes perfect sense.

Best wishes,

Mark

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

Hi goodcompany,

To answer each of your questions in turn:

That is to say, the pin_lat/lng vars seem to be overwritten by those of the map. Curious as to why/how this could happen. Or maybe this is normal and to be expected for a centered map 😊

Got it in one. If you drag the map off-centre in the Control Panel, and then save it, you’ll notice that the map and pin have different lat / lng values.

Also weird that when I try to build a link to the larger google map the pin doesn’t appear. Clicking on the google logo in the bottom left corner returns the same result - a large map with no pin. Maybe the maps API is having trouble today…

The following should work:

http://maps.google.com/maps?q={pin_lat},{pin_lng}&sll;={pin_lat},{pin_lng}&z={map_zoom}

Cheers, Stephen

       
goodcompany's avatar
goodcompany
51 posts
16 years ago
goodcompany's avatar goodcompany

Thanks, Stephan.

Good answers. But just a quick check for anyone reading this - does this give you a pin? 😊

http://maps.google.com/maps?ll=57.1032107,12.2905275&spn=57.1032107,12.2905275&z=16

I have the pin in my CP and on my site, it’s just not showing up here (for me). Again, maybe a hiccup in the API.

       
Stephen Lewis's avatar
Stephen Lewis
466 posts
16 years ago
Stephen Lewis's avatar Stephen Lewis
Good answers. But just a quick check for anyone reading this - does this give you a pin?

No, but using those coordinates with the URL structure I previously posted does.

I’m not overly familiar with the structure of the Google Map URLs in truth, and the URL I posted above was discovered by reading this Wiki article, and trial and error.

Stephen

       
smartpill's avatar
smartpill
456 posts
16 years ago
smartpill's avatar smartpill
Thanks, Stephan. Good answers. But just a quick check for anyone reading this - does this give you a pin? 😊 http://maps.google.com/maps?ll=57.1032107,12.2905275&spn=57.1032107,12.2905275&z=16 I have the pin in my CP and on my site, it’s just not showing up here (for me). Again, maybe a hiccup in the API.

If you change

maps?ll=

to

maps?q=

the pin shows.

       
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

       
First 3 4 5 6 7 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.