shapefile

NetworkX - How to create MultiDiGraph from Shapefile?

梦想的初衷 提交于 2021-02-18 19:25:30
问题 I'm just picking up NetworkX and trying to learn how to use it with Shapefiles. Right now I have a .shp with a road network that I want to represent in a Graph with NetworkX, so that I can find the shortest path between 2 GPS points. I tried using this, but the problem is that when I run the write_shp() function I lose edges because DiGraph does not allow more than one edge between the same two nodes. The arrow in the figure below shows an example of an edge I lose by using a DiGraph. So I

NetworkX - How to create MultiDiGraph from Shapefile?

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-18 19:24:08
问题 I'm just picking up NetworkX and trying to learn how to use it with Shapefiles. Right now I have a .shp with a road network that I want to represent in a Graph with NetworkX, so that I can find the shortest path between 2 GPS points. I tried using this, but the problem is that when I run the write_shp() function I lose edges because DiGraph does not allow more than one edge between the same two nodes. The arrow in the figure below shows an example of an edge I lose by using a DiGraph. So I

Count number of points in multipolygon shapefile using Python

最后都变了- 提交于 2021-02-16 08:56:15
问题 I have a polygon shapefile of the U.S. made up of individual states as their attribute values. In addition, I have arrays storing latitude and longitude values of point events that I am also interested in. Essentially, I would like to 'spatial join' the points and polygons (or perform a check to see which polygon [i.e., state] each point is in), then sum the number of points in each state to find out which state has the most number of 'events'. I believe the pseudocode would be something like

Count number of points in multipolygon shapefile using Python

帅比萌擦擦* 提交于 2021-02-16 08:53:06
问题 I have a polygon shapefile of the U.S. made up of individual states as their attribute values. In addition, I have arrays storing latitude and longitude values of point events that I am also interested in. Essentially, I would like to 'spatial join' the points and polygons (or perform a check to see which polygon [i.e., state] each point is in), then sum the number of points in each state to find out which state has the most number of 'events'. I believe the pseudocode would be something like

Reading ESRI shapefiles from the InputStream in Java

不问归期 提交于 2021-02-11 08:39:33
问题 I have a web application that is supposed to read a shapefile from a user's disk. I use a MultipartFile class (https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/multipart/MultipartFile.html) to upload it. As far as I understand, it is not possible to recover a file path from the MultipartFile . It causes a problem for me because I use the following code to interpret the shapefile content (I attach the constructor which is crucial): private ShapeFile(final File

Test intersection of two MULTIPOLYGONS based on year cycles in R

筅森魡賤 提交于 2021-02-10 17:36:23
问题 I have two multipolygons and I want to test intersections between their geometries based on groups of years. Basically I have a flood multipolygon that contains flood events and their geometry and an election dataset which has each election as ward*year units, containing the geometry of that ward. I want to see if there are any intersections in the electoral ward each cycle prior to each election. So if the election was in 2009 and the cycle was 2007-2009 I want to see if its ward was flooded

How to convert shapefile to tile based file

十年热恋 提交于 2021-02-08 03:24:48
问题 I am developing a Map based iPhone application where I have to draw a map of any specific region depending upon the current location of that device. Client is supplying me the .shapefile consisting of all the co-ordinates and data to draw the map. We can store the shape file on the server and i think to draw the map on device with the data presented on .shapefile I need the tiles with different zoom level. So on the server side I have to convert the .shapefile into tile based file. But I don

How to extract NetCDF data frame by region using a polygon shapefile

拈花ヽ惹草 提交于 2021-01-29 10:31:32
问题 I'am trying to extract the variable "swh_ku" from multiple NetCDF files together with their corresponding latitude and longitude values into csv files using a polygon shapefile or it's extent. I'm working with Jason-1 global altimetry swath data but I only need the data for the domain represented by the shapefile. I just need help with some lines of code that would complete the working code bellow so I can extract only the data for the region I'm interested in. I've tried several software

Using R intersections to create a polygons-inside-a-polygon key using two shapefile layers

不羁岁月 提交于 2021-01-28 08:00:52
问题 The data I have two shapefiles marking the boundaries of national and provincial electoral constituencies in Pakistan. The objective I am attempting to use R to create a key that will generate a list of which provincial-level constituencies are "contained within" or otherwise intersecting with which national-level constituencies, based on their coordinates in this data. For example, NA-01 corresponds with PA-01, PA-02, PA-03; NA-02 corresponds with PA-04 and PA-05, etc. (The key will

in R, save a shapefile

倖福魔咒の 提交于 2020-12-05 20:20:33
问题 I would like to save a shapefile after a manipulation. First, I read my object map<-readOGR("C:/MAPS","33SEE250GC_SIR") After this, I subset my shapefile: test <- fortify(map, region="CD_GEOCODI") test<- subset(test, -43.41<long & long < -43.1 & - 23.05<lat & lat< -22.79) I get the corresponding id's of this subset ids<- unique(test$id) map2<- map[map$CD_GEOCODI %in% ids ,] When I plot the map2, it is all right. But, when I try to save this shapefile, somethinh is wrong writeOGR(map2, dsn =