add search bar function to embedded google html map - google-maps

I created a map using the new Google Maps and I am using the "embed this to my site" feature, but it has no search bar. The intent of the map is to enter an address to see if you fall within a boundary I created but I don't know how to alter the HTML code to add a search feature. I also have next to no HTML experience, so please be kind.
Here is what I have as the embed code:
No actual space between first < and iframe but I added it for it to show up
<iframe src="https://mapsengine.google.com/map/embed?mid=z-3d_xUUkSNQ.kL7YAhEFIavc" width="640" height="480">
</iframe>

There are many things you can do. One idea is you can use the address provided by your users to obtain the coordinate of the location. This can be done via google Geocoding service. Then from there you can determine if the given address falls within the region you have provided. You probably want to start playing around with HTML and Javascript first for a more complicated task like this.

Related

Maps on a website

I am working on a land parcels management system. The website is offering search services for land parcels. I am trying to integrate the website with maps. A person can search for a piece of land using an available land ownership document number such as a title deed, and then, the website locates the piece of land on the map and displays the relevant information.
I have the option of archGIS, but I can't figure out how to create the maps and convert the map data into database variables and database variables into mapd. Can someone help me please?
Yeah, it is possible, you can do one thing, I can show you how to insert maps in a website using Google Maps though, not ArchGIS.
First, you should make a web-page of how many land you have and when the user clicks on the link it will make a new page where you can show the map you want. Or else you could create some rows and columns and insert the map there but the first one is a lot easier for you.
Alright, now you have to go to Google Maps and search the place of which you want to insert in your web-site then click 'Share' which will be available on the left, a new window will open, then click on Embed a map.
Then a code like this will generate = '<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3681.9191333728836!2d88.41682721453802!3d22.65680348513951!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x39f89e60501dda2d%3A0x2698d72c277affc7!2sOneSolution%2CBirati!5e0!3m2!1sen!2sin!4v1527664105639" width="600" height="450" frameborder="0" style="border:0" allowfullscreen></iframe>'
Paste it in your website and the map will be visible.

Embed mymaps on website with possibility to see current position on mobile

I want to embed "my maps" to my website using iframe, but I want to let my clients to open that map in a new window and see their location on it.
If I open my map in edit mode on my phone: www.google.com/maps/d/edit?mid=*** I see my position, if I change the mode to "view" it stops tracking my location.
Is there a way to open the big map and to see the current position? It's very useful... Maybe there is another way to embed it...
Based on the documentation
url: https://developers.google.com/maps/documentation/staticmaps/intro?hl=en
it seems that it is not possible to get the current location (position of the client) using the parameters which go along with the url. This means that you can not use iframe and embed google maps inside it to get your current position.
However, you can still use geolocation and program it to get the user current position on the map,
url (code included in the link): https://developers.google.com/maps/documentation/javascript/examples/map-geolocation
Bare in mind that the google map API will always ask you the permission to access data in order to locate you.

Removing top left panel of embedded google map

I'm embedding a google map with a marker on it using the embed feature whereby i'm given the URL below. My problem is that the top left panel encroaches too much and I would like to remove or contract it. I this possible? I have seem somewhere that introducing "output=embed" somewhere into the url helps but I can't get anything to happen in this example..
<iframe src="https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d48862.31335129727!2d-1.763692!3d53.701791!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x0%3A0x2c8856d4951c5657!2sFrederick+Crowther+and+Son+Ltd!5e1!3m2!1sen!2suk!4v1421754685023" width="469" height="345" frameborder="0" style="border:0"></iframe>
I don't think this is possible.
You would need to use the google maps api.
This definitely does allow you to choose which default google maps controls to show and hide.
It's not very difficult to use the api. Here is a good tutorial on setting a basic map with markers.
Here is a guide to hiding controls or using custom ones.

add an address search to a custom google map

I am using the new google maps system and an embedded iframe to add my google map into my page with my custom locations.
What I am missing is a way to have a user search their address to see which location is nearest them.
The map lists local Disc Golf courses and I would like to incorporate a search bar that allows you to put in your address so you can see how close you live to the nearest course.
Any idea on how to accomplish this?
Here is my current iFrame code:
<iframe src="https://mapsengine.google.com/map/u/0/embed?mid=zgauQ93-BexQ.kryT1881iie4" width="640" height="480"></iframe>
Displayed on the site:
http://atxdiscgolf.com/
As you can see... no search bar! I want to be able to search addresses on this map so I can see how close they are to home! Please let me know!
Also let me know if you have any Disc Golf courses to add to my list!
I figured out how to do it!
First, I used the "sample code" found here:
https://developers.google.com/maps/documentation/javascript/examples/places-searchbox?hl=fr
Then I read about KML layers so...
https://developers.google.com/maps/documentation/javascript/examples/layer-kml
I went to My Maps, clicked export as KML, checked to update when my map updates then directed the KML to the file location that I downloaded the KML file from from My Maps.
It worked! I have a searchable map with my custom overlay embedded!!
It won't let me post more than 2 links so I will post the link to my fiddle in the comments below:
Check out the sample code in the documentation. It adds a search box to the map, which is what it sounds like you're looking for. If you want to be able to get directions or calculate distances, you may have to use other libraries/apis, though Google Maps v3 does already have a lot of the methods already (like computeDistanceBetween).

How could a share a Google map mashup with my own datapoints and links back to my site?

I currently have a map mashup that has locations that I'm populating from my own database. A few users would like to also show that map on their site(s). I'd like to give them the ability to do that, but would like to retain the actual functionality of the map on my own site: like add "stuff" to places on the map through my a web form on my site. I could open the entire API to allow them to create their own form along with the data points, but most of the people wanting to put up the map aren't developers, they are just enthusiasts that have put together a personal page that they want to spice up.
I was thinking I could just provide a JavaScript of some kind that they could then take to place on their site, or maybe an IFRAME of some type, or...any ideas? Anyone implemented this? TIA.
I haven't done anything like this myself, but I think your idea to utilise an iframe is on the right track. In fact, this is how Google Maps generates its embed code.
Your app will need to generate a URL with all relevant Google Map parameters such as bounds, zoom level as well as your application-specific params. Any event that triggers the map to re-draw (drag, zoom, etc.) will generate a new URL.
If you try the embed link in Google Maps as an example, it generates a URL that looks something like this:
http://maps.google.com/maps?f=q&source=s_q&sll=45.434035,12.339057&sspn=0.003294,0.004812&ie=UTF8&ll=45.432724,12.338966&spn=0.006588,0.009624&t=h&z=17
This URL can then be wrapped up in an iframe which your end users can place on their web pages.
Re: resizing
Yes, it's possible to dynamically resize it if width/height is part of your application params that generates the embed code. Again using Google Maps as an example:
<iframe
src="http://maps.google.com/maps?f=q&source=s_q&sll=45.434035,12.339057&sspn=0.003294,0.004812&ie=UTF8&ll=45.432724,12.338966&spn=0.006588,0.009624&t=h&z=17&output=embed"
width="(width-param)" height="(height-param)"></iframe>
If you mean resized by user, after it's been displayed, I'm not sure.. most likely, yes.