shapefile

Restricting plot to shapefile boundaries in r

假装没事ソ 提交于 2019-12-01 22:28:33
I have analysed a dataset of GPS points using density.ppp to generate a sort of heatmap of intensity of the points, as shown below: However, I would like the image to be limited to the borders of the shapefile, similar to below: The first image is called as x <- readShapePoly("dk.shp") xlim<-c(min(912),max(920)) ylim<-c(min(8023),max(8030)) a<-ppp(cases@coords[,1], cases@coords[,2], xlim, ylim, unitname=c("km")) plot(density.ppp(a, 0.1), col=COLORS) plot(x, add=T, border="white") where cases@coords are the GPS coordinates of each point of interest, and x is a shapefile which provides the

How to know if topojson is installed and working normally?

ぐ巨炮叔叔 提交于 2019-12-01 13:57:09
How to know if topojson is well installed and working normally? An example tiny file to convert will be appreciate. with both the source and expected result If you haven't stumbled across this yet I found it to be a great walkthrough of the entire process: http://bost.ocks.org/mike/map/ The above link also includes the command to run to check if topojson is installed: $which topojson If topojson is installed correctly this will print out the directory where it's installed, which might look something like this (but could be different): /usr/local/bin/topojson If the command doesn't print

Looking for a function allowing to select/identify polygon that share a line segment with a source polygon

时间秒杀一切 提交于 2019-12-01 06:58:29
问题 In order to select/identify the border polygons of a shapefile, I would like to use a function able to select/identify polygon that share a line segment with a source polygon. With figures: I have this kind of shapefile: Using gUnionCascaded from rgeos package, I have a second shapefile with the "contour polygon" Now I am looking for a function that can select/identify border polygons (shaded on the fig) i.e. polygons of the first shapefile that share a line segment with the polygon of the

Shapefile to raster conversion in R?

二次信任 提交于 2019-12-01 04:06:16
I have a shapefile downloaded from the worldwildlife.org for the terrestrial ecoregions of the world. The file can be loaded here: http://worldwildlife.org/publications/terrestrial-ecoregions-of-the-world . It comes as a standard shape file and I would like to do two things with it. First: take the shapefile from my local directory and clip it to an extent of eastern North America (ext= extent (-95, -50, 24, 63)) # Read shapefile using package "maptools" eco_shp <- readShapeLines("F:/01_2013/Ecoregions/Global/wwf_terr_ecos.shp", proj4string=CRS("+proj=utm +zone=33 +datum=WGS84")) # Set the

Convert a shapefile from polygons to points? [closed]

依然范特西╮ 提交于 2019-11-30 16:24:38
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 other free program I can run on a Mac. NOTE: I'm throwing this up in part to learn whether there's a

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

佐手、 提交于 2019-11-30 13:50:19
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 molecular drug resistance of malaria parasites. I would like to plot them so that the color is the

Need the path for particular files using os.walk()

微笑、不失礼 提交于 2019-11-30 11:54:30
问题 I'm trying to perform some geoprocessing. My task is to locate all shapefiles within a directory, and then find the full path name for that shapefile within the directory. I can get the name of the shapefile, but I don't know how to get the full path name for that shapefile. shpfiles = [] for path, subdirs, files in os.walk(path): for x in files: if x.endswith(".shp") == True: shpfiles.append[x] 回答1: os.walk gives you the path to the directory as the first value in the loop, just use os.path

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

南笙酒味 提交于 2019-11-30 09:16:26
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 how to use this from my program. Can someone provide me with an example of how to implement this? How

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

可紊 提交于 2019-11-30 07:58:35
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 enough. foreach (Line2D g in lines) { foreach (Line2D h in lines) { if (g.intersectsLine(h)) { return false;

How to Import shape file into MySQL

烈酒焚心 提交于 2019-11-30 07:18:24
I need to import the spatial data in shape file into MySQL tables. I am able to import into PostGreSQL. Any pointers for MySQL. I need the data in MySQL table. try this whit FWtool instaled ogr2ogr -f MySQL MySQL:database_name,host=localhost,user=root,password=1234 C:\route_path\line.shp -nln datatable_name -update -overwrite -lco engine=MYISAM try install for better result in any proces Osgeo4w http://trac.osgeo.org/osgeo4w/ I have just used the ogr2ogr command line tool to import the shape file into the mysql database. Make sure that the database server allows external connections. If doesn