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

GeoJSON layer on Google Maps API is not showing

July 30Hits:6
Advertisement

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

[[[[-3.58466299999998,40.653534],[-3.58416399999999,40.645122],[-3.57777099999998,40.645808],[-3.56814799999995,40.643543],[-3.56669199999999,40.650369],[-3.55906599999997,40.650485],[-3.562074,40.645539],[-3.55856,40.642499],[-3.55641499999996,40.636165],[-3.56240699999995,40.637156],[-3.56385,40.634403],[-3.56028999999995,40.62432],[-3.55866899999995,40.624382],[-3.559326,40.612243],[-3.55188399999997,40.611541],[-3.54740999999996,40.613852],[-3.54317099999997,40.612906],[-3.53588499999995,40.616672],[-3.52996099999996,40.613629],[-3.52470799999998,40.614486],[-3.52360699999997,40.616052],[-3.51882999999998,40.615856],[-3.50475,40.62025],[-3.50232199999999,40.619824],[-3.50347599999998,40.625645],[-3.49253299999998,40.624856],[-3.486874,40.625408],[-3.48826199999996,40.61937],[-3.48614299999997,40.615703],[-3.47918699999997,40.613561],[-3.47633099999996,40.609201],[-3.47601399999996,40.604547],[-3.46338799999995,40.607617],[-3.457448,40.606575],[-3.45370599999995,40.60743],[-3.46489399999996,40.598167],[-3.46592699999997,40.595318],[-3.46756299999998,40.595986],[-3.47589299999999,40.59241],[-3.482843,40.587501],[-3.48226799999998,40.586469],[-3.48881599999999,40.58506],[-3.49518,40.585953],[-3.50831399999998,40.58232],[-3.52083099999999,40.581192],[-3.52729499999998,40.582836],[-3.52976099999995,40.582188],[-3.52989299999996,40.58424],[-3.53294899999997,40.58501],[-3.54014899999999,40.583977],[-3.53991399999995,40.582635],[-3.545323,40.583943],[-3.54951199999999,40.587284],[-3.55304899999999,40.586448],[-3.56139099999996,40.587875],[-3.561644,40.592727],[-3.56544099999996,40.592964],[-3.56566199999997,40.598347],[-3.57579699999997,40.601903],[-3.57759999999996,40.607995],[-3.57447999999999,40.610901],[-3.573981,40.618885],[-3.57977899999997,40.619304],[-3.58072199999998,40.623112],[-3.58449400000001,40.627281],[-3.58942199999996,40.633644],[-3.59164399999997,40.640263],[-3.58941299999998,40.644885],[-3.59190799999999,40.648937],[-3.59346299999999,40.654804],[-3.58933299999995,40.655884],[-3.58466299999998,40.653534]]]] 

Answers

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) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.776 s.