shapefile

Convert a shapefile from polygons to points? [closed]

瘦欲@ 提交于 2019-11-29 23:27:24
问题 I have a non-overlapping polygon-based shapefile (.shp) with a large spatial extent and many dozens of associated attributes. The shapefile is projected in UTMs. I would like to convert the polygons to points spaced out in a 30-m resolution grid, in which each point would retain the attributes of the polygon it is located within. Output would simply be a table of the points: X, Y, attribute1, attribute2, attribute 3,etc... I would ideally like to do this operation in R, or (less ideally) some

How do you combine a map with complex display of points in ggplot2?

早过忘川 提交于 2019-11-29 19:44:42
问题 I'm trying to plot points from study sites with a background map of Africa. I can create the two independently, but I am having a hard time overlaying them on top of eachother. The map of Africa I am using is an Esri shapefile from maplibrary.org. It is available from my dropbox at https://www.dropbox.com/s/etqdw3nky52czv4/Africa%20map.zip. I have the points in a text file, also available from my drop box. https://www.dropbox.com/s/scvymytjsr5pvaf/SPM-437-22Nov12.txt. They refer to studies on

Best way to overlay an ESRI shapefile on google maps?

╄→гoц情女王★ 提交于 2019-11-29 18:51:28
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? Aaron Kreider 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

How to subset a shapefile

 ̄綄美尐妖づ 提交于 2019-11-29 15:32:33
The data set of shapefile "Property1A" is: df # suburb area asst # 0 Te Aro 14.541780 R076 # 1 Te Aro 7.655428 R076 # 2 Te Aro 3189.976134 <NA> # 3 Te Aro 242.173386 0132 # 4 Karori 537.697290 R003 # 5 Pipitea 1116.954993 R105 # 6 Mt Cook 106.099900 R151 # 7 Te Aro 83.307421 R057 # 8 Aro Valley 544.665788 R105 # 9 Aro Valley 59.726882 R110 When I try to subset the shapefile for suburb "Te Aro", the code I use is: TeAro <- subset(Property1A, suburb == "Te Aro") But there is an error: TeAro <- subset(Property1A, suburb == "Te Aro") # Error in eval(expr, envir, enclos) : object 'suburb' not found

How to run GDAL (ogr2ogr) in Java to convert Shapefiles to GeoJSON

霸气de小男生 提交于 2019-11-29 14:09:38
问题 I'm a beginner at programming and get pretty confused when trying to use external libraries. I have my maps in shapefiles that I convert to GeoJSON using the website Mapshaper.org, and only then can i read the map from my Java application. I want the user to be able to import a shapefile directly so I found out about GDAL ogr2ogr that has Java bindings, and can make this conversion with a single command such as: $ ogr2ogr -f GeoJSON -t_srs crs:84 [name].geojson [name].shp but I have no idea

Filling shapefile polygons with a color in matplotlib

女生的网名这么多〃 提交于 2019-11-29 12:24:38
I am searching way to fill polygons of a shapefile based on a value. So far from basemap tutorial ( http://basemaptutorial.readthedocs.io/en/latest/shapefile.html ) i 've found how to fill the polygons with a specific color. import matplotlib.pyplot as plt import pypyodbc from mpl_toolkits.basemap import Basemap from matplotlib.patches import Polygon from matplotlib.collections import PatchCollection from matplotlib.patches import PathPatch import numpy as np fig= plt.figure() ax= fig.add_subplot(111) m=Basemap(projection='cyl',llcrnrlat=34.5,llcrnrlon=19,urcrnrlat=42,urcrnrlon=28.5,resolution

Shapefile to Topojson conversion

我的梦境 提交于 2019-11-29 11:54:48
I am trying to convert the Ghana admin1 shapefile that can be found here . My end goal is to obtain a TopoJSON as described in this question . I have used this command on a Linux machine: ogr2ogr -f GeoJSON GHA_adm1.json GHA_adm1.shp And it returns this: Unable to open datasource `GHA_adm1.shp' with the following drivers. ... here goes a long list of drivers... I am I doing something wrong? Should I install other "drivers"? But how? Thanks. Hugolpz Download the GIS source GADM is the perfect source for administrative GIS files. GADM.org > Download page : select your country and format

Implementing a brute force algorithm for detecting a self-intersecting polygon

房东的猫 提交于 2019-11-29 10:24:47
问题 I initially implemented the Hoey-Shamos algorithm, however it is too complex for future maintainability (I have no say in this), and it wasn't reporting correctly, so an optimized brute force algorithm is what I'm going to use. My question is: How can I optimize this code to be usable? As it stands, my code contains a nested for loop, iterating the same list twice. EDIT: Turned lines into a HashSet and used two foreach loops... shaved about 45 seconds off scanning 10,000. It's still not

Append/Combine Shape Files

社会主义新天地 提交于 2019-11-29 08:17:31
I have a very simple operation I would like to perform: combining two shape files. Specifically, I have census tract shape files for each state in the US that I would like to combine into one shape file. Ultimately, I want to take the combined shape file and perform an overlay on a set of latitude and longitude coordinates, to determine which census tracts my coordinates fall into. I have seen much discussion on this ( Combining bordering shapefiles in R ). However, all of the discussion are outdated and I am hoping that the packages have been improved in the meantime. The files I am using are

Use ggplot to plot polygon with holes (in a city map)

别等时光非礼了梦想. 提交于 2019-11-29 08:05:55
I have 3 shp files for create a city map: land.shp (polygon drawing the land which is above water) road.shp (polygon drawing all the roads, note that some of them are "circular road", which means a hole is in the middle) building.shp (polygon drawing all buildings) I used QGIS to plot the map I want, then I use ggplot to play the land.shp, then road.shp and building shp to do it again. The one below is output from Google map to illustrate my issue: You can see there are 2 bridges and some sea (I don't have sea shp, I just set the background to be blue) between them, tagged using blue dot. In R