Display GeoJSON file data on web map using ArcGIS JavaScript API

5998
7
Jump to solution
02-18-2015 02:31 PM
ChrisHolmes
Occasional Contributor III

Hello everyone,

I have data that is stored in GeoJSON format that I would like to be able to display on a web map. Anything I have read so far about GeoJSON indicates that the data must be in Geographic Coordinates (wkid 4326). Which I believe this file is not? Based on the snippet below:

{"crs":{
   "properties":{
      "name":"urn:ogc:def:crs:EPSG::3776"
   },
   "type":"name"
   },
   "features":[
      {"geometry":{"coordinates":[5368.1140,5659635.35],"type":"Point"},

Can anyone indicate if my thinking is correct? If so am I out of luck with getting this data to display on a map?

Thanks,

Chris

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
ReneRubalcava
Frequent Contributor

Not necessarily. GeoJSON is the spec for spatial data over the web. I don't know exact history, but I'm guessing Esri defined their spec of (not the official name) EsriJSON (which is part of their GeoServices spec). Like I said, not sure of the discrepency or reasons behind it, maybe a lot of it comes from ArcObjects stuff built up over the years.

Anyway, it makes sense that some would provide you with GeoJSON data for location information. If you still need to work with Esri data and this GeoJSON data you have, you may want to look at using esri-leaflet as Leaflet uses GeoJSON out of the box and esri-leaflet adds the ability to use ArcGIS services with it.

View solution in original post

0 Kudos
7 Replies
ReneRubalcava
Frequent Contributor

You may want to take a look at Terraformer.

It can convert data between GeoJSON and ArcGIS JSON Objects.

There's also this geojson-layer that was put up not too long ago. Haven't used it, but it looks pretty good.

0 Kudos
ChrisHolmes
Occasional Contributor III

Thanks Rene. I did read a bit at the terraformer site, but was under the impression that the coordinate restriction still applies?

0 Kudos
ReneRubalcava
Frequent Contributor

My bad, you're right.
I missed that bit in your sample GeoJSON.

Depending on how much data you have, you could run it through proj4js to convert the coordinates.

There's a post here on GeoNet on how you might work with it.

If you need to get hands on, this library has some code that may help to just convert the GeoJSON directly to EsriJSON regardless of projection. You basically just need to change the structure of the data.

0 Kudos
ChrisHolmes
Occasional Contributor III

Thanks again Rene, looking at around 2000 records in the GeoJSON file. I'll follow up on your suggestion.

Chris

0 Kudos
ChrisHolmes
Occasional Contributor III

Just an additional question. I do not know why the folks who wrote the code that creates the GeoJSON file chose to create it in GeoJSON. Would things be easier for me if they had created it as JSON?

Thanks,

Chris

0 Kudos
ReneRubalcava
Frequent Contributor

Not necessarily. GeoJSON is the spec for spatial data over the web. I don't know exact history, but I'm guessing Esri defined their spec of (not the official name) EsriJSON (which is part of their GeoServices spec). Like I said, not sure of the discrepency or reasons behind it, maybe a lot of it comes from ArcObjects stuff built up over the years.

Anyway, it makes sense that some would provide you with GeoJSON data for location information. If you still need to work with Esri data and this GeoJSON data you have, you may want to look at using esri-leaflet as Leaflet uses GeoJSON out of the box and esri-leaflet adds the ability to use ArcGIS services with it.

0 Kudos
ChrisHolmes
Occasional Contributor III

Thanks Rene. Sounds like I should learn about leaflet. I have come across reference to it in my searches, but didn't know what it was, also I have map services that I also want to reference. So it sounds like it could be a match.

0 Kudos