hackgvl / OpenData

Open data projects, including real-time and reusable data for local tech meetups, events, and map layers.
16 stars 3 forks source link

Syndicate Some/All of the Greenville County iMap #46

Closed allella closed 2 years ago

allella commented 6 years ago

Overview of IMAP

There are numerous community resource map layers in the Greenville County IMAP project, which is hosted under the Greenville County GCGIS / ArcGIS site.

The service is a partnership between GHS, United Way, Greenville County GIS and Furman's Community Engaged-Learning Collaborative.

These map layers are public and functional, but the data is intended for viewing by agencies / service providers and their clients. However, the data is otherwise trapped inside the ArcGIS Viewer tool unless you work with the ArcGIS API endpoints.

The GCGIS.org ArcGIS services include other map resources, but the IMAP layers / service is the most readily useful.

How We Can Help

The purpose of this issue is syndicate and promote some, or all, of these map layers so the data can be used and linked to in real-time by other map developers without putting a strain on the county's server.

The target audience of this syndicated data would be web developers or savvy users who want to create a map and link to IMAP layer data in psuedo-real-time.

A simple first iteration of this idea would involve querying GCGIS map layers, 1 or more times a day, using a scheduled cron job. The resulting data could be stored as a static GeoJSON file, or even other supported formats like json | kmz | amf. That static copy would be the "public" endpoint and since it's static a basic web server would be able to handle a good deal of load. However, the longer-term intention is to use a CDN or service like CloudFlare to host such syndicated data files so they are scalable and reliable.

Examples of Querying Map Layers for Features

The API documentation has a section on how to "query" the map layer endpoints.

As a simple example, map layer 1 "Child Care" can be queried for any map feature name containing the word "greenville" and the results returned in GeoJSON format.

We'll use layer 67 "Recycling Centers" for the next example.

The format parameter (&f=geojson) is very useful for our Code For Greenville map project because GeoJSON is a native format for Leaflet.

The resulting GeoJSON can pretty much be snapped into a Leaflet or Google Map as a layer and points will display.

This needs more research, but getting a list of all the "features" of a map layer is surprisingly confusing.

After a number of tries we tricked the query to return all features by checking "where" ObjectID > 0 https://www.gcgis.org/arcgis/rest/services/imap/imap/MapServer/67/query?where=OBJECTID>0&f=geojson&outFields=*&geometryType=esriGeometryPoint

We need to ask Rhett at GCGIS if there's a better way to select all features.

Another query that might be mildly useful is to request a map layer feature by one or more objectids.

The Query Builder UI

At the bottom of these HTML pages there is a link to a query builder which helps figure out the available query string parameters and values. It should be noted that many combinations of parameter and values generated using the query builder will return vague errors. So, you must persist, leverage the layer documentation and take informed guesses.

The query builder exposes all the query string parameters, leaving them empty if no values are entered in the HTML form.

https://www.gcgis.org/arcgis/rest/services/imap/imap/MapServer/67/query?
where=
&text=
&objectIds=1
&time=
&geometry=
&geometryType=esriGeometryEnvelope
&inSR=
&spatialRel=esriSpatialRelIntersects
&relationParam=
&outFields=
&returnGeometry=true
&returnTrueCurves=false
&maxAllowableOffset=
&geometryPrecision=
&outSR=
&returnIdsOnly=false
&returnCountOnly=false
&orderByFields=
&groupByFieldsForStatistics=
&outStatistics=
&returnZ=false
&returnM=false
&gdbVersion=
&returnDistinctValues=false
&resultOffset=
&resultRecordCount=
&queryByDistance=
&returnExtentsOnly=false
&datumTransformation=
&parameterValues=
&rangeValues=
&f=geojson
allella commented 5 years ago

@Mozillex The recycling locations are now automated to pull from the Greenville County recycling layer, which is one of the iMAP layers.

https://data.openupstate.org/map/preview/recycling-locations/

Heads up to @MariaTaborda @igrozeva13 @ebeyerle

allella commented 5 years ago

Rhett with GC GIS said they have the Swamp Rabbit Trail mile markers in the GIS and that he'd move them to the iMAP layer. At that point we'd prefer to use the county's copy vs the community curated copy since the data is unlikely to change besides new points and the county runs the SRT.

allella commented 3 years ago

Goals

allella commented 3 years ago

Here's a good example of how a "Parks" map layer that's inside iMAP could be easily embedded into a site, using real-time data from iMAP, instead of having to send folks offsite or ask them to download a 3rd party app.

This is the power of the approach this project takes. It uses what's out there, but allows sharing and ownership as well.

http://livewellgreenville.org/livewell-near/

allella commented 3 years ago

At least one of the Greenville County GIS GeoJSON feeds has feature results with missing latitude and longitude, so we're having to filter it out. For now, it's being filtered on the LeafletJS side, as mentioned at https://github.com/codeforgreenville/OpenData/issues/50#issuecomment-698074694

allella commented 2 years ago

We've previously syndicated many of the map layers, as posted on https://data.openupstate.org/map-layers