shapefile

How to encode XML into ESRI Shapefiles using Python?

两盒软妹~` 提交于 2019-12-11 15:06:14
问题 I prepared the following Python script to this XML into ESRI Shapefiles. The starting point for the script was this post. #!/usr/bin/env python # -*- coding: utf-8 -*- # # Requires pyshp: https://pypi.python.org/pypi/pyshp # # Conversion for http://daten.berlin.de/datensaetze/liste-der-gedenktafeln-berlin # File: http://gedenktafeln-in-berlin.de/index.php?id=31&type=123 # from xml.etree import ElementTree from datetime import datetime import shapefile import os def get_value(list, index,

Convert .shp files to an excel spreadsheet programmatically

安稳与你 提交于 2019-12-11 12:46:57
问题 I have a file in .shp format and I need it to convert it to an Excel spreadsheet programmatically. I want to do this using PHP or JavaScript. 回答1: Once I've used small PHP lib ShapeFile, you can get it in phpclasses.org. Although it is a bit of not so good design, it works. Here is a little example from my own code: require_once 'lib/ShapeFile.inc.php'; $shp = new ShapeFile($filename, array('noparts' => false)); if ($shp->getError() !== '') print_r($shp->getError()); else { $records = array()

Move agents in nodes

試著忘記壹切 提交于 2019-12-11 09:24:37
问题 I am trying to move my agents from one vertex of my road network to another one which the following code. However, I got an error, saying that MOVE-TO expected input to be an agent but got NOBODY instead. If new location is already defined which this code as part of the agentset of slocation , where is the problem? to go ask citizens [start-movement] move end to start-movement let nearest-node min-one-of nodes [distance myself] set slocation nearest-node move-to slocation end to move ask

How to filter a shape file before plotting it in R

此生再无相见时 提交于 2019-12-11 08:28:34
问题 Just to try to filter a shape file to ease plotting I have a shape file downloaded from UK gov: http://geoportal.statistics.gov.uk/datasets/7ff28788e1e640de8150fb8f35703f6e_1/data?geometry=-76.678%2C45.365%2C69.572%2C63.013&orderBy=lad16cd&orderByAsc=false&where=%20(UPPER(lad16cd)%20like%20%27%25E0800000%25%27%20OR%20UPPER(lad16cd)%20like%20%27%25E08000010%25%27)%20 Based on this: https://www.r-bloggers.com/r-and-gis-working-with-shapefiles/ I wrote but do not know to filter : setwd("~

Close a spatial line into a polygon using a shapefile

好久不见. 提交于 2019-12-11 06:53:35
问题 I have a SpatialLinesDataFrame that was produced from a contour of marine environmental data. The contour is not closed where it meets land. I would like to close the contour so that I can calculate the area within the contour. I have a shapefile for the coastline. So, I would like to use the coastline shapefile to close the contour lines. Edit: Here's an image illustrating what I am trying to do. The black line is the contour and the red is the coastline. I want the area enclosed by the

Coloring a Shapefile map in ASP.NET

一曲冷凌霜 提交于 2019-12-11 06:52:43
问题 I have a Shapefile map of Maryland separated by zipcode. What I'd like to do is color each area based on a value I'm looking up in a database. Currently, I'm using ASP.NET with the SharpMap package. The basic questions are: 1) How do I associate a shape with its zipcode? I can generate the list of zipcodes using SharpMap's ExecuteIntersectionQuery with the BoundingBox set as the extent of the map, but I have no idea how to then connect each row of the resulting table with the shape it

Map Lat/Lon Points to a Shape File in R

时光怂恿深爱的人放手 提交于 2019-12-11 05:27:47
问题 I am trying to identify the zip code for each set of lat/lon coordinate using a shapefile. Lat Lon data is extracted from: https://data.cityofchicago.org/Public-Safety/Crimes-2017/d62x-nvdr (Crimes_-_2001_to_present.csv) Shapefile: https://www2.census.gov/geo/tiger/PREVGENZ/zt/z500shp/ zt17_d00.shp (zip code definitions for the state of Illinois) library(rgeos) library(maptools) ccs<-read.csv("Crimes_-_2001_to_present.csv") zip.map <- readOGR("zt17_d00.shp") latlon<-ccs[,c(20,21)] str(latlon)

Random lines when loading a TopoJSON file in D3

喜你入骨 提交于 2019-12-11 04:38:22
问题 I'm trying to display the Italian cartographic shapefiles, for example this one, using D3.js I can load the Zip file on MapShaper, look at the map, simplify it and export to TopoJSON. I can load back the TopoJSON in MapShaper and it still looks ok. But when I try to display it using D3.js, I get a bunch of spaghetti: Beauty, isn't it? The code is taken straight from the examples. The projection center, rotation, and parallels are supposed to be the canonical ones for Italy, but it doesn't

git trying to push non-existent file … after clearing cache

拈花ヽ惹草 提交于 2019-12-11 04:04:17
问题 I have a number of shapefiles in my repo that were too large, thereby causing my push to GitHub to fail. I initially tried to create a .gitignore file that excludes most of the extensions in shapefile bundles. It still tried to push the shapefiles. After some searching, I found I had to clear the cache: git rm -rf --cached . git add . However, once I tried to commit and then push again, I found that this did not fix the problem. The same shapefile was hanging things up. After much messing

Combining SpatialPolygonsDataFrame of two neighbour countries

浪尽此生 提交于 2019-12-11 03:33:01
问题 I want to combine the SpatialPolygonsDataFrame of two neighbour countries like Pakistan and India. My MWE is below: library(raster) Pakistan.adm1.spdf <- getData( "GADM" , country = "Pakistan" , level = 1 ) India.adm1.spdf <- getData( "GADM" , country = "India" , level = 1 ) How can I combine these two shapefiles? 回答1: From the answer to this question, use rbind and the argument makeUniqueIDs . adm1.spdf <- rbind(Pakistan.adm1.spdf, India.adm1.spdf, makeUniqueIDs = TRUE) plot(adm1.spdf) 来源: