shapefile

SpatialPolygonDataFrame plotting using ggplot

为君一笑 提交于 2019-12-05 18:29:43
I am having a shape file for the greater London area. I use the readShapePoly function from the maptools package to load it in R as a SpatialPolygonDataFrame . I want to the plot those polygons .. Which I have already done by using the basic of plot function in R. The output looks as shown in this image: Now, I am trying to plot the same shape file using ggplot2 but it doesn't work with me. I am getting some weird lines in the graph as shown blew: The code I used was : london.wards <- readShapePoly("~/TD/london_wards2013/london_wards2013.shp" , proj4string=CRS(projString)) wards.count <- nrow

Read shape file with readOGR verses readShapePoly

匆匆过客 提交于 2019-12-05 14:46:19
问题 I have read a shapefile using readShapePoly in the maptools package, but cannot read that same file with readOGR . I am hoping someone may be able to help me read the shapefile with readOGR . I downloaded the file orcounty.shp from here: http://geography.uoregon.edu/geogr/topics/maps.htm I also downloaded the associated files: orcounty.shx , orcounty.sbx , orcounty.sbn , and orcounty.dbf and put all five files in the folder: c:/users/mark w miller/gis_in_R/shapefile_example/ The following

Error when opening shapefile

我只是一个虾纸丫 提交于 2019-12-05 11:52:36
I am trying to open a shapefile in R, but I am getting the following error message: Error in getinfo.shape(filen) : Error opening SHP file I have checked other responses and most problems seem to have been solved by ensuring that the .dbf and .shx files are in the same folder. I have them all in the same folder (along with some other extensions too) but I still get the error message. I work on a mac. This is my code: getinfo.shape("/Users/Suz/Desktop/DWH satellite maps/20100517_Composite.shp") I have tried it without the .shp extension, and with other commands, such as readShapePoints etc.

b'Recode from ANSI 1252 to UTF-8 failed with the error: “Invalid argument”.' geopandas python

喜夏-厌秋 提交于 2019-12-05 06:40:18
I am trying to read in a shapefile into a GeoDataFrame. Normally I just do this and it works: import pandas as pd import geopandas as gpd from shapely.geometry import Point df = gpd.read_file("wild_fires/nbac_2016_r2_20170707_1114.shp") But this time it gives me the error: b'Recode from ANSI 1252 to UTF-8 failed with the error: "Invalid argument".' Full error: --------------------------------------------------------------------------- CPLE_AppDefinedError Traceback (most recent call last) <ipython-input-14-adcad0275d30> in <module>() ----> 1 df_wildfires_2016 = gpd.read_file("wild_fires/nbac

Shapefile with ObjectiveC

你离开我真会死。 提交于 2019-12-05 05:26:47
I like to know if there is a Class, in objective-C, that manipulates shapefile (read/write/edit)? I have found a bunch of stuff on kml files but nothing about shp files, but definitely want to avoid the need of converting files format (shp->kml). Thanks There's one from Pascal Brandt, ... (it's a little simplistic, but it certainly does the trick for me) ... CocoaShapeFile . He's just dressed up the C functions in Objective-C clothes, but it works just fine for reading. If you're shooting for iOS instead of Cocoa then you'll have to do just a little transcoding/conversion yourself. With only a

How can I transform the coordinates of a Shapefile?

爷,独闯天下 提交于 2019-12-05 03:46:16
I am trying to get neighborhood data into my application, and I'm having problems with the data I am using, which I got from here . This file contains a shapefile that has the neighborhoods of San Francisco. I am running a Ruby on Rails framework, and I'm currently using GeoRuby to parse the shapefile. The code looks like this: def self.run_import shpfile = '/path/to/realtor_neighborhoods/realtor_neighborhoods' ShpFile.open(shpfile) do |shp| shp.each do |shape| # This gets the first (and only) Polygon from each MultiPolygon polygon = shape.geometry.geometries.first puts polygon.inspect end end

TimeZone by Coordinate [duplicate]

南笙酒味 提交于 2019-12-05 03:14:43
This question already has answers here : How to get a time zone from a location using latitude and longitude coordinates? (14 answers) Closed 3 months ago . As the title infers I need to find a time zone (or perhaps just the UTC offset) based on a pair of coordinates. I've been searching for different solutions, and there is a couple of web services out there but I need to be able to access the application offline. As the timezones isn't completely based on longitude it doesn't seem that easy... I though about querying an ESRI shapefile I've got containing all the countries in world and their

Python: how to create a choropleth map out of a shapefile of Canada?

天大地大妈咪最大 提交于 2019-12-04 23:12:25
My goal here is to create a choropleth map of Canada in Python. Suppose I have a dictionary with values referring to each Canadian province/territory: myvalues={'Alberta': 1.0, 'British Columbia': 2.0, 'Manitoba': 3.0, 'New Brunswick': 4.0, 'Newfoundland and Labrador': 5.0, 'Northwest Territories': 6.0, 'Nova Scotia': 7.0, 'Nunavut': 8.0, 'Ontario': 9.0, 'Prince Edward Island': 10.0, 'Quebec': 11.0, 'Saskatchewan': 12.0, 'Yukon': 13.0} Now I want to color each province based on the corresponding value in myvalues , using a continuous colormap (e.g., shades of red). How to do that? So far I

Querying data in MySQL Geometry data type column

萝らか妹 提交于 2019-12-04 19:24:50
I have a table that stores polygons in a GEOMETRY data type column that I loaded via a shapefile using ogr2ogr. Here's the create statement: CREATE TABLE IF NOT EXISTS `sunzones` ( `OGR_FID` int(11) NOT NULL AUTO_INCREMENT, `polygon` geometry NOT NULL, UNIQUE KEY `OGR_FID` (`OGR_FID`), SPATIAL KEY `polygon` (`polygon`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=105 ; Here is a sample record: POLYGON((449455.354522821 2447255.57758461,449700.419971925 2447132.08575524,449970.797988416 2447012.08302579,450331.302189915 2446845.08750142,450720.557402377 2446631.12366577,451001

How to convert csv to shp in R

旧时模样 提交于 2019-12-04 17:24:10
I have been trying for the past couple of days to convert a csv to shapefile. I know I can easily do in QGIS or Arc but would like to add this process into my existing R code. So i can read in the csv with no issues MyData <- read.csv(file="c:/TheDataIWantToReadIn.csv", header=TRUE, sep=",") I found the code below from the Packages Shapefile help guide. However I can't seem to find a way for it to work on my code. My rows are each a point, therefore my shapefile I am trying to create will be all points. I don't have an Id column, however I do have x and y data in two separate columns. dd <-