Home > google maps > GeoJSON layer on Google Maps API is not showing

GeoJSON layer on Google Maps API is not showing

July 30Hits:6

I am using the following codes to visualize a GeoJSOn on Google Maps API.

var geojsonFeature = {                                     "type": "Feature",                                     "geometry": {                                       "type": "Polygon",                                       "coordinates": JSON.parse(JSONobject[0].JSON).coordinates[0]                                     }                             };                             var googleOptions = {                                 strokeColor: "#FFFF00",                                 strokeWeight: 7,                                 strokeOpacity: 0.75                             };                              var myGoogleVector = new GeoJSON(geojsonFeature, googleOptions);                              if (myGoogleVector.error){                                 // Handle the error.                             }else{                                 myGoogleVector.setMap(map);                             } 

Its returning the following error

uncaught reference error GeoJSON is not defined

here is the GeoJSON fetching from database



I used this web to validate GeoJSON: http://geojsonlint.com/

After pasting yours, I got:

Invalid GeoJSON
POSTed data was not JSON serializeable.

Try this link to test all your GeoJSON files to see where is the error.

Hope this helps,

Related Articles

  • GeoJSON layer on Google Maps API is not showingJuly 30

    I am using the following codes to visualize a GeoJSOn on Google Maps API. var geojsonFeature = { "type": "Feature", "geometry": { "type": "Polygon", "coordinates": JSON.parse(JSONobject[0].JSON).

  • Add a OpenStreetMaps road data layer on Google Maps API v3September 14

    I've successfully embedded a Google Maps API v3 map on my site, and added OpenStreetMaps (OSM) as the base layer. Is it possible to use Google's tiles as the base layer, and then overlay street data on top of that, rather than the entire OSM layer? <

  • Removing Google maps base layer from Google Maps APIOctober 12

    I need to remove the base layer of google maps dynamically. User can add or remove the base layer.Because I am using more layer on top of it.Is there any function in google maps api to remove the basemap and leave it as a blank. --------------Solutio

  • Mousemove event is without pixel value for data layer in Google Maps APIDecember 3

    I'm trying to track mouse position over elements in data layer. I would expect this to work: map.data.addListener( 'mousemove', function(evt) { console.log(evt.pixel); } ) but pixel is not set (Pixel property is populated correctly, when listening on

  • Google Maps API toggle layer based on multiple feature propertiesJanuary 18

    UPDATED WITH GEOJSON Attempting to reach different types of properties within a single GeoJson file in Google Maps API. I have a checkbox format within the legend, for multiple types (e.g. Schools, Parks, Hospitals). <div class="checkbox">

  • I can not override my WMS layer in Google Maps as a base

    I can not override my WMS layer in Google Maps as a baseApril 1

    I can not override my WMS layer in Google Maps as a base: I have a WMS layer in geoserver am using openlayers to show them. Calling only works WMS layer: see my code, I am using using the bounds used in geoserver bounds because they use the standard

  • WMS getmap tiles not matching in google maps API

    WMS getmap tiles not matching in google maps APIOctober 22

    I am trying to see a WMS layer above Google maps API's satellite baselayer. When building the WMS URL string I am using WIDTH=256 and HEIGHT=256 which I think is the default. The thing is that the tiles are not matching one with another. It can be se

  • QGIS KML layer won't show up in Google Maps APIOctober 28

    I've trimmed US Census shapefile data to show census blocks in just three states, by editing the attribute table. I then color coded the states based on values in the table by changing the style in qgis. Now I want to export the new map as a KML or G

  • Shift in the data between CartoDB and stamen layer, Google Maps API

    Shift in the data between CartoDB and stamen layer, Google Maps APIJanuary 13

    I have a geojson loaded into CartoDB database. And I have a CSV file too. Names field would be common in both the GeoJSON and CSV file. I had written a logic if the place name in CSV matches the place name in GeoJSON then just add the corresponding g

  • Can I use Google Maps API and substitute Openstreet map as base layer?September 28

    This Question is based on below requirements. 1 - our application will need to use functionalities of Google Maps API like custom marker/Info pop up/Routing etc. 2 - our application wants to use Openstreetmaps or our ownmaps as the base layer. Now ,

  • How to set up the layer order with Google Maps API?January 23

    I'm developing a web mapping site (using google maps api 3.0 and javascript) that combines wms layers and ground overlays (uploaded rasters) that are displayed on top of google maps. The software is working well except that I'm having problems contro

  • Text directions for google map API transit layer

    Text directions for google map API transit layerJanuary 25

    I am using Google Maps API for NY Subway transit map. I was able to display the transit layer and was able to implement the directions on map. However, I couldnt find any reference in the API documentation on how to bring in the transit text directio

  • What is a best practice way to display/feed US census/tiger data into Google Maps API?March 1

    Let's say I want to display age, income, etc based on census block groups on Google maps. What is the best practice or recommended way to do so and also to allow to do simple queries? --------------Solutions------------- I have spent a lot of time ma

  • Is it possible to query a MySQL database using the results from map.getBounds() with Google Maps API v3?March 13

    I have a MySQL database that contains a large number of polygons, one for each district on a map. They are all quite complicated and it's unrealistic to simply load them all at once. I've looked into using MarkerManager for Google Maps API v3 and thi

  • Does Google Maps API provide statistical tools or even raster to vector conversion?May 17

    I am working with a web developer who is working with Google maps API, trying to determine what pre-processing steps I should perform (e.g. in R and GRASS), and what can be done within the google maps API. This leads me to the following questions: Is

  • What's next if our KML is too big/complex for the Google Maps API?May 18

    Our web app includes simple mapping capabilities (currently just markers and KML overlays on an embedded Google Map). This works pretty well; the only real limitation we face is KML overlays that go beyond Google's size & complexity restrictions for

  • Disable point-of-interest information window using Google Maps API v3

    Disable point-of-interest information window using Google Maps API v3September 19

    I have a custom map with an information bubble and custom markers. When I zoom into points of interest such as parks and universities appear and when I click an information window opens. How do I disable the info window? My code is as follows: var ge

  • Google Map API 3 with OSM overlaySeptember 22

    I'm using GeoXml3 to parse XML files in Google Map and would like to add OSM as custom maptype. I fiddled with this example but it hides completely the original Google layers. I've found a couple of other examples but unfortunately all of them are us

  • Output polygon data from postGIS and read it on Google Maps APIApril 18

    So, I have a group of polygons stored in PostGIS. I'm trying to build a web application with Google Base maps (using Google Maps API). Now, How do i output the polygons in the right format so that Google Maps API can read it? I know about ST_Askml wh

  • Set ZIndex for Google Fusion Tables in Google Maps APIApril 23

    Is there any way to set the ZIndex of a Google Fusion Table layer in the Google Maps API? I have several Fusion layers added as overlays to a map with the ability to turn them on and off. I want certain layers to always be ontop if they are on, howev

Copyright (C) 2018 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.546 s.