1

I have obtained a geoJSON dataset from a publicly available dataset here which I have saved here.

When I loaded this data into the Google Maps Data Layer from a file on my system:

var goldCoastData = new google.maps.Data({
    map: map,
    style: {
        icon: 'images/marker_gc.png',
        strokeColour: '#0b2430',
        strokeOpacity: 1,
        fillColor: '#ff534f',
        fillOpacity: 1
    }
});

$.ajax({
    type: 'GET',
    url: 'scripts/datasets/goldCoast_buildings.json',
    dataType: 'json'
}).done(function (data) {
    console.log(JSON.stringify(data));
    goldCoastData.addGeoJson(data);
});

The data is not displayed on the map.I ran the following checks on the data:

  1. jsonlint(successfull)
  2. geojsonhint(successful)
  3. geojsonlint inconclusive/failure???
  4. drag and drop failure
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
vamsiampolu
  • 6,328
  • 19
  • 82
  • 183
  • The latitudes and longitudes in that data are in the wrong projection to be used on Google Maps. http://stackoverflow.com/questions/15015946/google-map-api-v3-projection – geocodezip Aug 08 '14 at 14:24
  • As geocodezip has said, that is the wrong projection, EPSG:28354, which is local to Australia, whereas Google Maps requires EPSG:3857, which is spherical mercator and covers the globe. You will need to reproject from one to the other. You can use http://trac.osgeo.org/proj4js/wiki/UserGuide for this. I know how to do this in OpenLayers directly, but not in Google Maps, so I can't give you a working example. – John Powell Aug 08 '14 at 16:51
  • Could you provide me with the string or a resource/steps to follow for creating the string for `EPSG:28354` so that I can use it as a [`named projection`](https://github.com/proj4js/proj4js#using) – vamsiampolu Aug 09 '14 at 04:33
  • As you recommended, use proj4 to convert it to [this](http://jsonblob.com/53e5db51e4b0bab7bd401bda),will this data work? – vamsiampolu Aug 09 '14 at 08:29

1 Answers1

2

I found that the geoJson added to the google maps Data layer needs to use the projection EPSG:4326 in order to work.I could obtain the data from the datasets in this format using the &SrsName=EPSG:4326 at the end of the url.

This links to data from the question in the correct format

From the comments to the question by @geocodezip and @John Barça state that Google uses EPSG:3857 so this must be some kind of a quirk,hopefully.

vamsiampolu
  • 6,328
  • 19
  • 82
  • 183