shapefile

How to Import shape file into MySQL

情到浓时终转凉″ 提交于 2019-11-29 03:11:11
问题 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. 回答1: 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/ 回答2: I have just used the ogr2ogr command line tool to import

Android lib to read or parse shapefile

旧街凉风 提交于 2019-11-28 23:49:42
is there any library that is able to read parse a .shp file, preferably on where I don't need to use NDK. I was trying to use GeoTools but i can't seam to get it to work on Android. I've been using two lightweight shapefile parsers with good results in Android: diewald_shapeFileReader and Java ESRI Shape File Reader . Geotools relies heavily on AWT and Java Service Provider Interface (SPI) both not supported by Android. So it´s not a viable option. 来源: https://stackoverflow.com/questions/19548044/android-lib-to-read-or-parse-shapefile

Clipping raster using shapefile in R, but keeping the geometry of the shapefile

时光总嘲笑我的痴心妄想 提交于 2019-11-28 18:50:38
I am using {raster} to clip (or crop) a raster based on an irregular shapefile (the Amazon biome) but the output always has a rectangular extent. However, I need the output in the exact same geometry of the shapefile. Any tips? Cheers. library(raster) library(rgdal) myshp <- readOGR("Amazon.shp", layer="Amazon") e <- extent(myshp) myraster <- raster("Temperature.tif") myraster.crop <- crop(myraster, e, snap="out", filename="myoutput.tif") One option is to use raster::mask() library(maptools) ## For wrld_simpl library(raster) ## Example SpatialPolygonsDataFrame data(wrld_simpl) SPDF <- subset

Intersecting Points and Polygons in R

狂风中的少年 提交于 2019-11-28 11:03:13
I am working with shapefiles in R , one is point.shp the other is a polygon.shp. Now, I would like to intersect the points with the polygon, meaning that all the values from the polygon should be attached to the table of the point.shp. I tried overlay() and spRbind in package sp, but nothing did what I expected them to do. Could anyone give me a hint? Spacedman If you do overlay(pts, polys) where pts is a SpatialPointsDataFrame object and polys is a SpatialPolygonsDataFrame object then you get back a vector the same length as the points giving the row of the polygons data frame. So all you

How to subset a shapefile

China☆狼群 提交于 2019-11-28 09:53:50
问题 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 <-

shapefile and matplotlib: plot polygon collection of shapefile coordinates

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-28 07:48:53
I'm trying to plot filled polygons of countries on the world map with matplotlib in python. I've got a shapefile with country boundary coordinates of every country. Now, I want to convert these coordinates (for each country) into a polygon with matplotlib. Without using Basemap. Unfortunately, the parts are crossing or overlapping. Is there a workarund, maybe using the distance from point to point.. or reordering them ? Ha! I found out, how.. I completely neglected, the sf.shapes[i].parts information! Then it comes down to: # -- import -- import shapefile import matplotlib.pyplot as plt import

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

烂漫一生 提交于 2019-11-28 05:48:53
问题 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

sp::over() for point in polygon analysis

自古美人都是妖i 提交于 2019-11-28 05:20:33
I have a shapefile named "ind_adm" and a SpatialPointsDataFrame called "pnts". The "pnts" contains points generated at random, and some of the points overlap with the polygon. See picture below. Now, I want do do a point in polygon analysis, i.e. I want to find out which points lie inside the gray polygon representing the boundary of India. For this I am using the over() function in the sp library. pt.in.poly <- sp::over(ind_adm, pnts, fn = mean) #do the join However, the output I am getting is >pt.in.poly values 0 6.019467 I should actually get the index of the points that are "in" the

R - stuck with plot() - Colouring shapefile polygons based upon a slot value

微笑、不失礼 提交于 2019-11-28 04:01:44
问题 I have a shapefile showing remote areas in Australia, obtained from the Australian Bureau of Statistics: http://www.abs.gov.au/AUSSTATS/abs@.nsf/DetailsPage/1270.0.55.005July%202011?OpenDocument At the same URL is a PDF "ASGS Remoteness Structure Edition 2011 PDF Maps" - I am trying to reproduce the first map from this PDF document. I have read in the shapefile and added colour information to the data slot: ra <- readShapeSpatial("RA_2011_AUST", delete_null_obj = TRUE) ra@data$COLOUR <- "

Create convex hull polygon from points and save as shapefile

ⅰ亾dé卋堺 提交于 2019-11-27 19:49:50
Needing some help re a conversion problem in R. I've got calculated the convex hull of a cloud of points. I'd like, from the points forming the convex hull, to build a polygon object and save that as a shapefile that can be read by a GIS software (ArcMap or the like). My code looks like this: gps <- read.csv(f) ##reads the lat-long coordinates file x <- gps$LONGITUDE ##tells R which columns is which y <- gps$LATITUDE z<-chull(x,y) ##calculates the convex hull --this is just a list of x-y points, N vertex dfHull <-cbind(x[z],y[z]) ##the convex hull expressed as a list of selected x-y points