Jonathan
Jonathan

Reputation: 5547

Google Maps API Highlight Geographical Area Data

I want to be able to show outlines of postal codes, cities/suburbs and states/territories in Australia via Google Maps. The idea would be so give the user a way to click within the area to select it.

I understand that I can create an overlay to show the outlines, but to do so, I need data to draw the outlines.

I noticed when I search on Google, then click the maps result, it highlights the city/suburb/state. This seems to work for all of the suburbs I have tried in Australia, as well as for US states/cities.

Here is an example:Denver Outline

So, my question is: How do I find the data I need to do this and/or can I somehow rely on the Google Maps API to get this data for me?

Thanks in advance!

EDIT:

Thanks to @Mano_Marks, here is a data source provided by the AU government: http://www.abs.gov.au/AUSSTATS/[email protected]/DetailsPage/1259.0.30.0022006?OpenDocument

Now I just need to figure out how to actually use this to build overlays with Google Maps.

Upvotes: 4

Views: 8281

Answers (1)

lngs
lngs

Reputation: 698

I don't know what is the cleanest way to do but you can upload those KML files or something to Google fusion table. They provide an API to style polygons from your datasets.

and you can do somthing like

    layer = new google.maps.FusionTablesLayer({
        query: {
          select: 'geometry',
          from: 'your data ID',
        },
        styles:[],
      });

and

layer.styles.push({strokewidth:xxx, strokecolor:yy, fillOpacity: blahblah});

go check this https://developers.google.com/maps/documentation/javascript/layers

Upvotes: 2

Related Questions