Wednesday, 8 May 2019

Exporting layers from ArcGIS into PostGIS while preserving attributes such as color


I have managed to import/convert a KML into ArcGIS 10.0 (ArcMap) using the built-in conversion tools and now have a series of layers. Next, I export these layers to a PostGIS database using the following command:


ogr2ogr -f "PostgreSQL" PG:'host=localhost port=12345 dbname=mydb user=removed password=removed' Roads.gdb -progress --config PG_USE_COPY YES

Note that when doing so, four separate layers are stored as a single layer in PostGIS - I'm unsure whether or not that is relevant. Anyhow, next, I use GeoServer with the PostGIS database as a store to serve the layer using WMS, and have a Leaflet client display the tiles overlaid on various other tiles.


Somewhere in this process all color attributes from the data are apparently removed (The data are a set of lines over roads, colored based upon speed limit - each color is a separate ArcGIS layer).



How can I preserve the attributes of my data? I have access to ArcGIS Desktop, PostGIS, OGR/GDAL, and GeoServer.



Answer



The following program ArcMap2SLDConverter will generate an SLD file from an ArcGIS Map - but you must have ArcGIS installed and running to do so.


This SLD can then be uploaded to GeoServer, and used to style the corresponding layer.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...