Neatline and OpenStreetMap, or OSM to WKT

I am developing an Omeka-Neatline project on historical textile mills in Mumbai. India, in which I wish to use polygons exported from OpenStreetMap (OSM).

For this I am using the WKT (Well-Known Text) format required by Neatline for entering polygon information in plain text in the “Spatial Data” field in the “Map” tab in the Editor for a given record.

Here is my problem: while Neatline saves the record with the WKT text entered in the “Spatial Data” field, I just do not see the polygon rendering on my map (the help pop-up states that the geometry should appear on the map as soon as I paste the WKT in).

If I exit and reload the map and Neatline Editor after having saved the geometry and select the record, the map remains stuck “Loading…”. When I pan over tiles where I have given custom spatial data they don’t load in some views.

I have tried re-importing items and updating records, changing base layers, switching off certain layers and even regenerating my Google Maps API key. Note that I am not using GeoServer with Neatline – is this a requirement? I assumed it was not as I already have access to the available drawing tools in the Neatline Map Editor.

This may have something to do with how Neatline parses and renders WKT, or with how I am trying to generate WKT from OSM. I experimented with various ways which Neatline would not accept and returned an error message when I tried to paste and save data in the “Spatial Data” field.

An earlier OSM2WKT tool from the OpenStreetMap community no longer works. I tried via PostGIS and also this online converter. None of the WKT output I could generate would be saved in Neatline, I would just get a red error.

I found the best and fastest way to convert OSM features to WKT was using OSM Nominatim reverse geo-coding by querying the OSM way ID. Here is an example of a Nominatim query for this textile mill in Mumbai:

https://nominatim.openstreetmap.org/reverse?osm_type=W&osm_id=112794197&polygon_text=1

Where polygon_text=1 indicates output in WKT format as per the Nominatim documentation for polygon output. Nominatim returns the exported WKT as "geotext="POLYGON...".

Neatline accepts this WKT, but is still not rendering the actual feature on the map, nor do I see any errors. Can someone please advise?

Hi shekhar,

I’ve passed your question on to our Neatline development team, and will get back to you with any advice.

Thanks,
Elizabeth

I may have answered my own question as I experimented with the Neatline map drawing tools and realised it was live transcribing the corresponding WKT into the text box below ‘Spatial Geometry’ for anything drawn on the map.

But I couldn’t understand why the coordinates and data in the text box didn’t match coordinates from my WKT generated from OpenStreetMap via OSM Nominatim Reverse when I pasted them into the box for entering my OSM-exported polygons. They wouldn’t render.

I found an answer on this page on on the Neatline Github site which explains that the WKT must be entered in the EPSG 3857 projection system, not EPSG 4326 (or WGS 84) projection. This is GIS speak to many people who may be trying to paste in standard WKT.

OSM data is stored in WGS 84/EPSG 4326 and [Nominatim] and other geocoding services which serve OSM data (points, lines, polygons) only return coordinates in this standard projection system. To use the Neatline Spatial Geometry field for importing shapes one thus requires a further conversion step via other GIS tools (or online converters which I don’t recommend).