Google Maps Information

Asked

Viewed 148 times

1

I would like to know the following... I have some map images, which indicate a certain coverage, I would like to add these images over google maps... I believe this is not difficult... The big problem I see is that these images have a density.

The darker the purple, let’s say, homicide rate - ex:100, the lighter, Homicide - ex: 10... and so on.

inserir a descrição da imagem aqui

So I don’t know how it’s done in google maps. Imagine that when you click on the map it will have to inform me data.

As this is done on google maps, I add the image, or will have to create with the google maps API? Have some example?

2 answers

1


The ideal would be to use Google Maps' own resources and draw the regions instead of placing an image inside.

I created in the Jsfiddle an example.

Basically you define the coordinates of the region that will be drawn the location.

Example of the important part:

var homicidioCoords = [
    new google.maps.LatLng(-9.86062814536589, -50.25146484375),
    new google.maps.LatLng(-9.384032109601689, -56.75537109375),
    new google.maps.LatLng(-12.876069959946493, -57.041015625),
    new google.maps.LatLng(-14.477234210156507, -54.0087890625),
    new google.maps.LatLng(-13.26133317079826, -50.64697265625),
    new google.maps.LatLng(-9.86062814536589, -50.25146484375),
];

// Constrói o desenho.
areaAfetada = new google.maps.Polygon({
    paths: homicidioCoords,
    strokeColor: '#FF0000',
    strokeOpacity: 0.8,
    strokeWeight: 2,
    fillColor: '#FF0000',
    fillOpacity: 0.35
});

The way out:

inserir a descrição da imagem aqui

With this you can go creating the regions and inserting the colors as you wish. I also put an event to when right-clicking the mouse to show the latitude and longitude of the location. The best way would still be to carry out the whole drawing on the map, and save the coordinates.

As I said, the example is in Jsfiddle an example. References: Polygon-simple

  • thanks that’s what I was looking for, I’ll even have to draw the maps. To finish you know some program or site, where I can be uploading the image and click over the points and it returns the JS of the coordinates?

  • @abcd unknown

  • 1

    I searched well, found some... Polygon Creator Class, just modify... ATT

0

Browser other questions tagged

You are not signed in. Login or sign up in order to post.