How can I highlight an area in the Google Maps API? [duplicate] - google-maps-api-3

This question already has answers here:
Highlight a area with Google Maps JavaScript API v3
(2 answers)
Closed 7 years ago.
I want to highlight an area someone's searching for on Google Maps.
For example, something like what this place displays:
How can I do this using map api v3?

It's not possible through the current maps API/places API, unless you actually have these points yourself (from your question, it doesn't seem like it). Google's APIs will only return you a bounds, not a set of coordinates (or even encoded polyline) to be able to draw an outline around a specific area.

This might be usefull!
But again, you'd need to have the points from what I saw.

Related

Use a list of SKUs in a google sheet to pull their data from GOAT marketplace [duplicate]

This question already has an answer here:
Guidance on webscraping using Google Sheets [duplicate]
(1 answer)
Closed 1 year ago.
I am looking to pull the price data for each of the SKUs I have listed in a google sheet.
My initial try was the use a formula inside of the sheet.
=importxml("SKU Search URL", "//p/span[#data-qa='grid-cell-price']/text()")
This does not work, since the content is dynamic.
What would be the easiest method of obtaining this data?
Google Sheets does not support web scraping of JavaScript controlled elements. you can easily check it by disabling JS for a given site and only what's left visible can be scraped. in your case, that's nothing, unfortunately:

google maps api multiple scripts use sensor or not [duplicate]

This question already has an answer here:
How do I use the Google Maps API GPS sensor?
(1 answer)
Closed 9 years ago.
I have a site that has two maps on one page one uses the sensor and one doesn't. If I add two scripts I get errors.
<script type="text/javascript" src="//maps.google.com/maps/api/js?v=3&sensor=false"></script>
<script type="text/javascript" src="//maps.google.com/maps/api/js?v=3&sensor=true"></script>
Am I just supposed to use one?
Yes you only use one.
If you want to use the sensor then set it to true. Likewise if you don't want to use it.
In my experience leaving it as true causes no issues if you don't plan to use it.

Google maps API v3 - Gray out or remove states?

Is it possible to either gray out, or even better remove all together, states I do not want to see from the map? Not able to find any clear answers on this when searching. I am attempting to show just a map of Texas and place markers on it.
Thanks!
Are you looking for something like this (v2) example by Marcelo?
Here is a v3 example using FusionTables
You can also do the same thing with KmlLayers

Access to KML tree

I have some rutes in KML format and I can't modify them. I want to draw them on a map but I also want to get the fist and last points to check for near cities and interesting places.
The problem that Google Maps API does server-side procesing and I cannot access individual elements form it. I searched and tried to use a parser like GeoXML but it's not exactly what I want because it uses its own map style an so on and I have to use Google API maps. I only do need to acces certain elements of KML tree and i will draw them using Google Maps API.
Can anyone help please? Thanks in advance for answer in these vacation days(for some).
You can use the standard KmlLayer in Google Maps for rendering, and then use a 3rd party library like GeoXML (or your own code to read the XML) to grab whatever data you need from the KML and run additional functions based on that.

Where to start with map application [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
i'm trying to desing a new application which allow user see he/her current location on a custom map (office, university compus, etc). but actually i have a couple of question in my mind (i haven't designed this kind of application before). i'm wondering:
How can i draw my own maps, what is the best option for it? there any format that i have to care of, there are any specification about it ?
Once i have my custom map. how can i do to mapping a global position system with the local positions ?
What are the tricks behing zoom on maps ? just differents layers with more or less informations and those layers changes on users demand ?
If a whant to mark some specific points over the map, like a cafeteria, boss's office etc, how can i do that ?
Sorry if my questions are too much generics and dumb, but i really need some clues about this topic because i don't have any idea how to design this kind of application as best as possible. and we don't whant to reinvent the wheel.
I will appreciate any help that you can provide me in order to desing this application
There are a number of approaches you can take to creating a maps application. Which one you use depends on the set of features you want to support, and the degree of control you want to maintain over the product.
If you want something like an embedded google map, then clearly the JavaScript Google Maps API may be best solution. If you need to support further features from the server side, like directions, you can make use of the web services api:
http://code.google.com/apis/maps/documentation/webservices/index.html
If, on the other hand, you essentially need a zoomable map of an area that you can define with markers and borders drawn from your database, and you want complete custom control over this image without having to rely on Google Maps' data or branding, then you can fairly easily build a scalable image either on the client or server, or both.
To start, you will need a set of point coordinates from which to draw your map. These can be derived from the SVG generated by a program like Adobe Illustrator when you draw vector graphics. Thus you could draw your own map in Illustrator and use the generated svg to create your map. In this case you will have to read about SVG and understand how to use it. Raphael.js is an excellent library that offers cross-browser compatible handling of SVG. If your map is of a familiar region, such as a country, you may be able to find SVG coordinates for it already on the web. You could start by grabbing a subset of the data in this file on wikipedia for the country or region you want to map.
Once you have a set of coordinates that define your map areas, you can keep them in a config file that can be read into memory from disk by your application as needed. It's convenient to save this data in the form of a hash, where each set of key-value pairs stores a separate svg 'path', or set of point coordinates that forms a closed shape. These could represent, for instance, the counties in a state.
Once you have the appropriate 'paths' stored in this manner, it is relatively easy to write a wide variety of software implementations.
Check out the imagemagick convert
documentation for the -draw
option for an example of how to
draw a png, jpeg, or gif on your
server from your stored svg paths.
Adam Hooper has some brilliant ideas of what to do with a custom map using SVG on the client side:
http://adamhooper.com/eng/articles/9
Note that you do not necessarily
need to use SVG. Here's an
example of a map drawn on the
server using ImageMagick, with a
highlightable clickmap drawn over it
by the browser, where the
highlighting is handled by the
jquery maphighlight plugin, which
uses the canvas element where it is
supported and VML in its place on
Internet Explorer browsers. All of
these layers (ImageMagick,
client-side click-map, and
client-side javascript highlighting)
are built with straight lines drawn
between point coordinates, so none
of this is actually SVG, and may be
easier to understand. Have a look
at the page source to see how the
click map is drawn, then look at the
maphighlight plugin to understand
what's going on:
http://davidlynch.org/js/maphilight/docs/
A third option, if you need to support more google-maps-like features, but want to add your own map data without using an overlay, is to implement some application of Open Street Maps. If you go to openstreetmap.org, find the area you want to customize, and click the edit tab at the top, you can edit the map as needed for your area. This edits the map data for all users of the Open Street Map service. Then you can get the openlayers javascript from http://openlayers.org/ to render a map on your website from Open Street Maps data that you can freely edit yourself. Also see the OpenStreetMap Wiki that tells you more about the OpenStreetMap movement.
If you don't want to reinvent the wheel, then don't try do do it: take the Google Maps API, add some markers and you're done. Zooming included. They have examples to guide you and there's loads of knowledge about the usage.
All you need is a free API key.
Edit: Your comment in the original question indicates that you want to use a custom overlay over existing maps. That's also possible as this example shows (see docs for custom overlays).
In the effort to not reinvent the wheel (which is definitely a good idea), much of the work of the maps themselves has already been done. The simplest approach will be to integrate Google Maps into your application. To address your individual points:
You don't have to draw your own maps. Tons of them already exist. Unless you're asking about drawing maps of indoor facilities yourself and plotting on those? In which case, how do you plan to approach this from a hardware perspective? GPS won't work well.
You need a piece of hardware that supplies the GPS coordinates. From there, you can just call the API to plot it.
Already done.
Calls to the API. Just provide the location (address, GPS, whatever you have) to the API. GPS will be more accurate, of course. But I'm pretty sure there's a geolocation service as part of the API and you can store the coordinates locally and adjust them manually if they're inaccurate.
If I'm off-base from your actual idea here, let me know. "Maps" is, of course, vague.

Resources