How to convert longitude and latitude data into shapefiles for NetLogo - gis

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.

Related

QGIS: all my points end up in the Atlantic Ocean

I'm following the tutorial guides in QGIS webpage, but I can't correctly import the dataset from the .csv file in the guide.
Here you can download the .csv file
Here you can download the shape .shp file
I imported the shp just by double clicking on it inside of QGIS
I pressed ctrl+L to open the delimited text layer window
from there i selected the .csv file using x as longitude and y as latitude
Here the result
Wrong point localization
What I did
The latitude and longitute coordinates look correct in the .csv file
I copied a location coordinates from the world map (ireland in my case) and I created a test .csv file with those coordinates. When import the csv file in my project it is placed in the atlantic Ocean and not in Ireland.
Is this a bug? I really can't understand what is happening.
As you can see the points are relatively well distributed, that means the original information is correct but there is something that has to do with the scale of the points that does not work (even tho coordinates are not ambiguous)
You will need to know a few things.
1.If the files you are using have coordinates systems assigned to them.
I am unsure about shp files as i deal mainly in Mesh Datasets and Rasters.
I do know that the CSV coordinates or Text file coordinates if they are GPS values ie:Lat Long have to be saved into a co-ordinates system value and that the QGIS project has to use the same coordinate system. The system uses the GPS coordinates to place the points accurately on the QGIS map. My Method is to use a site like bbox and use my Coordinates system of choice and record these Lat Long values into .CSV and then copy the same CRS settings from bbox within QGIS project then the shp and or imported files end up placed correctly when you load the imported text file layer or shp file. Also file formatting is important for text files like you have ie:CSV. If you set the CRS within the QGIS project if the layer you import in is from another CRS QGIS will automatically change this to the CRS you have set. If you do not have geographic information setout correctly you will have the problem you have now also another problem is if the file does not contain CRS information at all.
But from what you are telling us this looks like a CRS mismatch problem.
2.What the coordinates system is for the files you have ie:epsg 4326 or 3857 these are two very different different systems that can drastically alter the placement of your points.
3.If they dont have a coordinate system assigned to them then you will need to assign one and use this same coordinates system within QGIS project before you import in the files. .
4.If the files do contain coordinate systems references then in QGIS you will need to set the project CRS system to the same as the files you have. This will apply the CRS to all layers you add to this project weather they are vectors, mesh, rasters and or base layers.
Good luck.

Netlogo and GIS extension unsupported projection file

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.)

Netlogo GIS unsupported shape type file

During the SETUP loading phase of shp files of an urban model, Netlogo states:
Extension exception: unsupported shape type 15
error while observer running GIS:LOAD-DATASET
called by procedure SETUP
called by Button 'Go'
This happens when it tries to load this shp file: ZC.shp
Is there any way to fix this problem?
I have saved the shp file again but without z-axis information, and it worked

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 can't seem to plot latitude and longitude points after I've added a shapefile. What went wrong?

I am trying to add a shapefile that is a map of Manhattan wards and then plot some latitude-longitude data points over this map. I'm new to ArcMap and GIS in general.
Here is exactly what I am doing:
I have a shapefile that shows Manhattan wards when I "Add Data" it into ArcMap. I then go to Geoprocessing -> ArcToolbox -> Data Management Tools -> Projections and Transformations -> Define Projection. I then input my .shp file and select NAD 1983 State Plane New York Long Isl FIPS 3104 (US Feet) for the coordinate system. After I do this, my shapefile displays just fine.
I then "Add Data" a .csv file which contains addresses and the latitude and longitude for these addresses. I then right-click on this layer and select "Display XY Data...". I then make the "X Field" latitude and the "Y Field" Longitude and use the same coordinate system as mentioned above. However, the points never display. I still only see the wards shapefile displayed. Both layers are present in the Layers menu, but only one is actually being displayed.
Alternatively, if I restart ArcMap and add the points first and display the XY data, I see that the points are displayed. After I add the shapefile, the shapefile does not display. I only see the points. It seems I can always display one thing but not the other.
Any thoughts on why this is happening?
I am using ArcMap version 10.2.0.3348 on a Windows OS.
I assume you are trying to overlay different spatial reference systems without telling arcmap which ones you use, so it cant reproject them to fit together.
When you say "latitude" and "longitude" you normally mean a geographic coordinate system like WGS84. Whilse X and Y often refer to a projected coordinate system like NAD. You defined NAD for both layers...I think you should define a geographic coordinate system for your CSV File, if it really contains geographic coordinates.
ArcMap uses the spatial reference system of the first layer which is added as the display SRS (you can change this afterwards for sure), thats why you saw your shapefile first and after restart and adding the points saw the points first.
If every layer has its SRS defined correctly, ArcMap will reproject them automatically to fit your display SRS. If you define the wrong SRS for one layer, Arcmap will do nothing for sure, because there is no need to reproject a NAD layer to NAD (although the coordinates have a completely different value domain and your points get drawed somewhere else....check this by right clicking on the CSV layer and "Zoom to Layer (extend)".
To make it more complicated: Because NAD83 and WGS84 rely on different geodetic datums, you have to transform. You find a predefined set of transformation parameters when you right click on "layers" in the "table of contents" on the left and select "properties". On the "coordinate system" sheet you see the "Transform" Button where you can select the transformation parameters which should be use to get from NAD83 to WGS84 and vice versa. A more detailed description can be found at this GIS SE