Netlogo and GIS extension unsupported projection file - gis

I am trying to import my ARCGIS Pro project to Netlogo and I am getting this error.
Extension exception: unsupported projection 'Mercator_Auxiliary_Sphere'
error while observer running GIS:LOAD-DATASET
called by procedure SETUP-MAP
called by Button 'setup-map'
How can I fix this issue?

First, go to the NetLogo User Manual section on the GIS extension. In the documentation for the primitive gis:load-coordinate-system, you will find a list of the projections that the extension can use. You will see that it can use several Mercator projections but not yours. So ideally you can fix this by going back to the GIS and saving your shapefile in one of the projections that NetLogo uses.
(I know almost nothing about GIS but: the GIS technician I work with often saves shapefiles for me in the Lambert_Conformal_Conic projection, while the GIS extension accepts only the Lambert_Conformal_Conic_2SP projection. We have learned to trick NetLogo by editing the shapefile’s .prj file to change the text "Lambert_Conformal_Conic" to "Lambert_Conformal_Conic_2SP". That makes the GIS extension think that we're using one of its projections, and it works. You could try this trick to tell NetLogo you're using one of the Mercator projections.)

Related

How to convert longitude and latitude data into shapefiles for NetLogo

I have some longitude and latitude data and would like to load them into NetLogo for modeling. I used QGIS to load and visualize the data successfully. Then I exported the data as shapefiles (.shp) format, and there are several other files being exported togeter with postfix .shx, .dbf, .qpj, .prj, and .cpg.
But when I tried to load the data in NetLogo as
extensions [ gis ]
globals [ elevation ]
to load
clear-all
set elevation gis:load-dataset "MyDir/XXX.shp"
gis:set-world-envelope gis:envelope-of elevation
end
it reported an error saying "Extension exception: only GEOGCS and PROJCS are supported"
I searched the error online and think maybe it is because the file I exported from QGIS is not supported by NetLogo. But I know nothing about GIS data, so have no idea how to fix this problem.
I compared my .prj file with the example file of NetLogo GIS extension, googled the difference, and found out the solution, which is as followed.
In the QGIS, click Project and select Properties. There is a CRS tag on the left. Open it and one can find a "Coordinate reference systems of the world" window, inside which click the first class named Geographic Coordinate Systems, and choose the one named GCS_WGS_1984_XX.
Click OK and go back to the main panel. Right click your layer and set the layer's CRS. Choose the GCS_WGS_1984_XX one. Now export the layer and it can be loaded by NetLogo successfully.

How to embed a map into Netlogo using GIS extension?

The format of the map imported should be preferably ".shp" file.Also please tell how to create such a file. I have tried KML but it didn't work.
Yes, vectors need to be .shp to be imported. You can create vector files in most GIS programs (ArcGIS, QGIS, etc) and export to .shp. Or there's online tools for converting KML to .shp (eg http://www.zonums.com/online/kml2shp.php)
Raster files need to be saved as .ASC or .GRD for use as a dataset in Netlogo.

Is it possible to export geometry data from a shapefile to CSV from QGIS?

I'm trying to get geometry data from a large quantity of shapefiles into a database (Google Datastore). The thing is, I don't need to work with maps, I just need the coordinates, so I would like just the numerical coordinates. Ideally I'd like to use CSV, but any plain text would be workable. I have a Mac and have been able to get QGIS installed (I also tried udig but the interface was baffling). While it is easy to load a shp file into QGIS as a vector layer, I'm lost as to how to export the geometry, or even if it is possible.
Does anyone know how to extract plain text geometry from a shp file? Ideally with QGIS, but any method would be appreciated.
The "You can simply right-click the layer entry in QGIS and select "Save as"" approach was right
But the "GEOMETRY=AS_WKT" in the OGR layer option was missing.
I may also be a good idea to convert the coordinate system to WGS 84, as CSV are usually expected not to be projected (and shapefile sometimes are)
You can simply right-click the layer entry in QGIS and select "Save as".
In the dialog, there's an option to save as "CSV".
There are plenty of options to refine the format of the generated CSV file, as well as there are many other file formats to choose from.
Update:
See here for a solution: https://gis.stackexchange.com/a/8846
Outdated Response:
It is possible, in a sort of roundabout way...
Open the attribute table for the layer you want to save.
Select all rows.
Copy the rows
Paste into a spreadsheet
Save the spreadsheet as a csv.
Unfortunately there is no way to do this directly in QGIS.
See here for more details:
https://gis.stackexchange.com/questions/8844/get-list-of-coordinates-for-points-in-a-layer/8911#8911

I notice world file is missing the zone paramter

I'm just trying to figure out how to create world file. I saw some explanation but I notice world file having the easting and northing values but not the zone value. So how the location of the map will be identified, or I'm missing something.
Thanking you.
The world file does specify numerical geographical location for an image, but it unfortunately does not contain any information about what coordinate systems is used.
Such information typically comes in a separate file with extension .prj and is defined usually with the WKT standard and via a unique EPSG code of the coordinate system.
To simplify the search for coordinate system definitions we created an online tool:
http://epsg.io/
There you can use simple search phrases and preview position of any coordinates on a map - and also download the .prj file mentioned above.
Because you have tagged your question with "maptiler" I expect you want to cut the map tiles from your geodata and world file with the MapTiler software.
The coordinate systems can be specified directly in MapTiler easily. See http://www.maptiler.com/how-to/coordinate-systems/

Best way to overlay an ESRI shapefile on google maps?

What is the best way to overlay a shapefile in Google Maps?
After some reading suggests that, converting shapefile into KML and overlaying KML in Google map is an option. If that is the case, how do I convert a shapefile into KMLs?
I believe there would be a few open source tools available for this conversion. Can anyone point to a tool to covert a shapefile to KML without any loss of data?
I like using (open source and gui friendly) Quantum GIS to convert the shapefile to kml.
Google Maps API supports only a subset of the KML standard. One limitation is file size.
To reduce your file size, you can Quantum GIS's "simplify geometries" function. This "smooths" polygons.
Then you can select your layer and do a "save as kml" on it.
If you need to process a bunch of files, the process can be batched with Quantum GIS's ogr2ogr command from osgeo4w shell.
Finally, I recommend zipping your kml (with your favorite compression program) for reduced file size and saving it as kmz.
as of 12.03.2019 FusionTables is no more...
Import the Shapefile into Google FusionTables ( http://www.google.com/fusiontables ) using http://www.shpescape.com/ and from there you can use the data in a number of ways, eg. display it using GoogleMaps.
I would not use KML. Instead, use GeoJSON which you can natively consume in Google Maps API now. It is a newer feature that didn't exist from the original responses.
In any case, simply open the SHP file in Quantum GIS, and then you can output it in any format you like (KML, GeoJSON).
If you are using Google Maps for Work, I found a premium extension that handles loading shapefiles directly where you can just connect direct to the shapefile that you generate from ESRI. I did a search on the CMaps site and found this snippet which loaded US by state shapefile: https://gmapsplugin.net/cmapsanalytics/assets/shapes/usstates.shp
var cMap = new centigon.locationIntelligence.MapView();
cMap.key([your_api_key]);
cMap.layerNames(["Basic Shapes"]);
cMap.dbfKeys([['Alabama','Alaska','Arizona','Arkansas','California','Colorado','Connecticut','Delaware','District of Columbia','Florida','Georgia','Hawaii','Idaho','Illinois','Indiana','Iowa','Kansas','Kentucky','Louisiana','Maine','Maryland','Massachusetts','Michigan','Minnesota','Mississippi','Missouri','Montana','Nebraska','Nevada','New Hampshire','New Jersey','New Mexico','New York','North Carolina','North Dakota','Ohio','Oklahoma','Oregon','Pennsylvania','Rhode Island','South Carolina','South Dakota','Tennessee','Texas','Utah','Vermont','Virginia','Washington','West Virginia','Wisconsin','Wyoming']]);
cMap.userShapeKeys([['Massachusetts','Minnesota','Montana','North Dakota','Hawaii','Idaho','Washington','Arizona','California','Colorado','Nevada','New Mexico','Oregon','Utah','Wyoming','Arkansas','Iowa','Kansas','Missouri','Nebraska','Oklahoma','South Dakota','Louisiana','Texas','Connecticut','New Hampshire','Rhode Island','Vermont','Alabama','Florida','Georgia','Mississippi','South Carolina','Illinois','Indiana','Kentucky','North Carolina','Ohio','Tennessee','Virginia','Wisconsin','West Virginia','Delaware','District of Columbia','Maryland','New Jersey','New York','Pennsylvania','Maine','Michigan','Alaska']]);
cMap.labels([['Massachusetts','Minnesota','Montana','North Dakota','Hawaii','Idaho','Washington','Arizona','California','Colorado','Nevada','New Mexico','Oregon','Utah','Wyoming','Arkansas','Iowa','Kansas','Missouri','Nebraska','Oklahoma','South Dakota','Louisiana','Texas','Connecticut','New Hampshire','Rhode Island','Vermont','Alabama','Florida','Georgia','Mississippi','South Carolina','Illinois','Indiana','Kentucky','North Carolina','Ohio','Tennessee','Virginia','Wisconsin','West Virginia','Delaware','District of Columbia','Maryland','New Jersey','New York','Pennsylvania','Maine','Michigan','Alaska']]);
cMap.polyDataSources([centigon.locationIntelligence.CMapAnalytics.DATA_PROVIDERS.SHAPE_DATAPROVIDER]);
cMap.layerTypes([centigon.mapping.Layer.TYPE.POLY]);
cMap.locations([["https://gmapsplugin.net/cmapsanalytics/assets/shapes/usstates.shp"]]);
cMap.panTo("USA");
cMap.zoomLevel(3);
Do you mean shapefile as in an Esri shapefile? Either way, you should be able to perform the conversion using ogr2ogr, which is available in the GDAL packages. You need the .shp file and ideally the corresponding .dbf file (which will provide contextual information).
Also, consider using a tool like MapShaper to reduce the complexity of your shapefiles before transforming them into KML; you'll reduce filesize substantially depending on how much detail you need.
Free "Export to KML" script for ArcGIS 9
Here is a list of available methods that someone found.
Also, it seems to me that the most efficient representation of a polygon layer is by using Google Maps API's polyline encoding, which significantly compresses lat-lng data. But getting into that format takes work: use ArcMap to export Shape as lat/lng coordinates, then convert into polylines using Google Maps API.
Just to update these answers, ESRI has included this tool, known as Layer to KML in ArcMap 10.X. Also, a Map to KML tool exists.
Simply import the desired layer (vector or raster) and choose the output location, resolution, etc. Very simple tool.
2018 already... I've found this fantastic online tool http://mapshaper.org/ to convert from ESRI shapefiles to SVG, TopoJSON, GeoJSON.
Here is the explanation of how to use it https://www.statsilk.com/maps/convert-esri-shapefile-map-geojson-format
Fast and straightforward! :)