How can I take numerous shapefiles and have them line up in GIS? - gis

I am trying to take a shapefile of subdivisions within a county that I have created and line it up with another shapefile that was given to me by the County Appraisal District (parcel data). When I try to get them to line up then my streets shapefiles is not aligned with everything else. They are all on the same coordinate system and I do not want to have to recreate the shapefile for the subdivisions. Any thoughts?

This is a question with answers that may be simple or may be very complex, depending on your situation. As a GIS developer, I've most commonly seen this as a symptom of an incorrectly defined coordinate system. However, whether this is the case or not, and what the solution is strongly depends on your environment. From here on, I'll assume that you're working in an ESRI package...
I agree with the other posters that your problem is one of mismatching projections and/or datum definitions.
The most important thing to understand as regards projections in ESRI software is this:
Manually setting the projection of a dataset (shapefile, geodatabase feature class, etc) in ArcCatalog does NOT reproject that dataset!!!
In order to reproject your data, you must EXPORT the data from an ArcMap session in which you've been working and where the data is obviously lined up correctly. During the EXPORT, you are given the choice of saving your data with the coordinate system of the underlying map or that of the original dataset.
Your best bet is to follow these steps to create a new dataset with the correct projection and then extrapolate what you need to do to fix your specific problem:
Create a new ArcMap session and set its coordinate system:
Do this in a fresh ArcMap session with NO OTHER DATA. Be sure to explicitly set the coordinate system of the ArcMap mapview to your desired coordinate system (I recommend the one that matches the data you're trying to overlay, or one from another well-established dataset).
Add one other dataset with a known good coordinate system.
Create your new dataset in this ArcMap session. Give your new data the same coordinate system as the ArcMap mapview and the one other dataset in the map. Set the XY domain of the new data to exceed the area defined by your other dataset, but don't go beyond the size that will reduce your desired spatial resolution.
Create your data. It can be any data at this point. Some lines, some polygons, etc. Save your work.
Export your new dataset. When prompted, choose to save with the coordinate system of the underlying mapview.
Create a new ArcMap session and add your new dataset. Then add your parcel dataset. They should now occupy the same space in your map window.
Edit your new data to your heart's content.
Some probable issues if this doesn't help:
You didn't follow these steps correctly - check the ESRI documentation; this is a well documented issue.
The parcel data you're trying to match doesn't have properly defined coordinate system. It's always possible that the keepers of this data don't know what they're doing and have munged it up. I've seen this problem more times that I care to admit.
You've matched the projection but have mis-matched the datum. Many municipalities are still using data in NAD27, which is way out of date. Some have moved to the modern NAD83. The difference can be up to 300 meters, depending on where in the country you are. Also, data that originates from surveying or GPS equipment is usually collected in WGS84 (the typical default for satellite surveying), which is for all practical purposes the same as NAD83, at least at mapping scale resolutions.
Try researching these issues and see how it goes. I'll say it again:
Manually setting the projection does NOT actually project that data!!
Good luck!

Your problem is probably one of projection
| projection: character string that names a map projection to use. See
| 'mapproject' (in the 'mapproj' library). The default is to
| use a rectangular projection with the aspect ratio chosen so
| that longitude and latitude scales are equivalent at the
| center of the picture.
`-----

Agree that your problem is projection. Is there a .prj file extension associated with either of your files? If not key first is finding out what projects you have. I would guess State Plane of some sort if you are dealing with U.S. centric local data from a local government.

Cadastral tools (surveyer tools) usually let you specify a handful of control points and will then "warp" the data to fit to your control points. This can be anything from a simple shift to something more complex. If everything is shifted by a few feet, you can also just use your "editor" to select all shapefiles and then move them however many feet necessary.
If you've verified that both shapefiles are using the same coordinate system, then projection is less likely to be the problem. It's fairly common for parcel data to be "offset" from other data sources (such as roads). This comes from inconsistent collection methods and points of reference.
Another source of error can be that one of the shapefiles has the wrong coordinate system specified. For example, if the roads were actually WGS 1984, but it's prj is set to NAD1983, you will see some significant errors. This usually happens if you had to manually set the coodinate system for a shapefile (i.e. it didn't include a PRJ and you created one).

Related

Is it possible to extract coordinates from a static map picture?

I was wondering if it were possible to extract coordinates from a static map picture like this:
Is it possible to extract the coordinates of the routes? The only idea I can come up with, other than manually getting them by hand, is by overlaying the map and extracting the exact coordinates that way.
The process that you are looking for is called georeferencing in a GIS context.
In order to determine the latitude/longitude coordinates of a point (or series of points in a line), you need to first establish coordinates of other known points. These are reference points of known locations (such as a distinctive coastline, or a city). Applying these to the raster image that you have, you can then overlay it on a map in a GIS application and then query other unknown locations on the image (such as the routes) to establish their latitude/longitude.
You could attempt this in a graphics program by looking at the x/y coordinates of the route pixels and compare to a known reference point pixel; however, the math on that is going to be tedious and you also wouldn't account for the map projection. Both of those are taken care of by georeferencing.
I would note that you should consider the results you get, even in a well-referenced GIS, to be approximate. The map deals with a very large spatial area, and the routes cover long distances. But since it dates from 2012 it was presumably made in a GIS application and so at least the source data is likely to be accurate :)
Additional resources:
Help Page for ArcGIS (both overview and instructions)
Help Page for QGIS (tutorial)

Read and display 1 or more raster files in Repast Simphony

I am new to using GIS aspect of Repast.
The agents have to get pixel values from multiple shapefiles and 2 raster files (based on lat, long), to decide their movement course at every tick.
So far, I first created a geography, then added the raster coverage to the geography.
My questions are as follows:
My agents will be moving in this geography, so do I need to create writable grid coverage (for rasters and shapefiles) and then add it to the geography?
Is it possible to add 2 raster files and 3-4 shapefiles to the geography?
How do I read data from a raster file? E.g. NDVI index from a vegetation raster file.
(I was looking at the Raster Layer class.)
All of the above mentioned files are created by year. So, I need to recreate these layers according to appropriate tick. Is this approach correct? However, my main question is , how do I display raster data in repast simphony? Some resources would be useful.
I have used the org.geotools package to read raster file in geotif format.
GeoTiffReader geoTiffReader = new GeoTiffReader(new File(filename));
GridCoverage2D coverage = (GridCoverage2D) geoTiffReader.read(null);
geography.addCoverage("coverage1", coverage);
Right now, there are no error messages, so I am assuming the code runs correctly (displays print stmts) and reads the raster file. However, displaying the raster data would be great.
For references, I suggest staring with the Repast Geography demo model, the GIS documentation on coverages (https://repast.github.io/docs/RepastReference/RepastReference.html#gis-raster), and the GeoTools GridCoverage API (http://docs.geotools.org/latest/userguide/library/coverage/grid.html). Repast Geography projections and displays are fully compatible with GeoTools GridCoverage2D implementations. You can use the GeoTools readers to create the coverages as you described in your example, or you can use the RepastCoverageFactory to create WritableGridCoverage2D, which are simply custom implementations of GridCoverage2D in Repast that allow agents to write to the coverage in memory.
If your agents only need to read from a coverage, then you can use the GeoTools readers to load the raster files and assign to the geography via geography.addCoverage("MyCoverage", coverage), and you can add as many as you like. You can also add as many agent layers from shapefiles as you like to the geography. This is also demonstrated in the Repast Geography demo.
One caveat is that the raster data for the coverages and the shapefiles for the agents should use the same CRS and projection. The Repast Geography assumes that all GIS data in the geograpy is in the same projection. Furthermore, the GIS3D display requires the data be in WGS84. GeoTools provides utilities for converting on the fly, but I would recommend re-projecting in an external GIS tool like ArcGIS or QGIS if needed.
To reference a loaded coverage, an agent may call geography.getCoverage(coverageName), and you can remove a coverage with geography.removeCoverage(coverageName). Once the agent has the coverage instance, it can read values from it directly via
double[] value = null;
DirectPosition pos = new DirectPosition2D(loc.x, loc.y);
coverage.evaluate(pos,value);
The type of value will depend on the data that's in the raster file, e.g. float, int, byte, etc. The value array will contain all of the values for each band that corresponds to the location, so you need to know how the raster file is indexed - usually the specs will be available from where you downloaded the file. In the case of an NDVI raster file, the index is probably a double or float, and might be the only value in the array.
You can certainly add and remove coverage layers at different ticks to simulate change over time. Just make sure that the ordering of agent-behaviors takes this into account, e.g. the coverages should be updated at the beginning of the tick so the agents use the new data each tick. You can create a layer manager agent who takes care of the updating. There should not be any issue with removing and adding layers based on tick, although I haven't tested this with displays so I'm not sure affect this will have visually.
To display the coverage layers you need to use a GIS3D display and then simply add the coverage layers with the display wizard in the Repast runtime. You can include multiple coverage layers in a single display. Coverage layers require a CoverageStyle to determine how the data in the raster translates to an image. Some raster files are indexed on self-contained specific color maps and you can first try using the DefaultCoverageStyle which is the default option in the Display wizard. Alternatively, you can provide the CoverageStyle class and use it to specify how the raster data determines the display colors. The CoverageStyle returns a GeoTools RasterSymbolizer instance and an example is available in the Geography demo in the BlueCoverageStyle class.

Land Cover Dataset

I'm interested in implementing some data visualizations as map layers. But I'm interested in generating data layers only above land area (land cover). A good example would be to plot population density over a coastal city. What is a good approach for this, when it comes to the data source and how to actually display layers with such detailed boundaries?
Technically, so far I'm using Leaflet.js and tiles based on OpenStreetMaps, but the question is not necessary technology specific. Also, I'm not interested in plotting this for the whole planet, but for areas of a few hundreds square kilometers (for e.g. a coastal city).
To better give an idea of what I'm interested in, this Koordinates map is something that is similar to what I'm interested in. However, I need something a bit more detailed on the borders.
Usually you need a desktop or server based GIS such coverage, but not JS to do the processing on the client side.
How you do the mapping (here: linking statistical data and land areas) depends on your data itself. You can load OSM based shape files into QGIS and do some python scripting or using the PostGIS commands to link your data and choose a map style.
Another idea would be http://geocommons.com that allow easy visualization if you upload CSV files.
Depending on your area of interest, you can obtain some highly detailed shapefiles from numerous sources. Especially if the local area provides GIS data to the public (many larger coastal cities do, e.g. New York, London). From there, you can create a GeoJSON text of the geometries (here's a free tool for that). Parsing the JSON is very simple and it's very easy to add it to leaflet maps. You can even get creative and add more keys to each geometry object with the data you want to visualize.

GRASS GIS: How to generate large DEM from contours; elevation points and coastline mask

I need to generate a DEM (10m Cell Size) of the entire coastline for South Africa. I've tried to generate it within ArcGIS, but the Annudem Algorithm that ESRI is currently using within Top To Raster is not capable of generating my DEM.
Please can anyone let me know firstly if GRASS GIS can handle DEM's this large (i.e. millions of cells) and can use shapefiles: Contours; PointElevation and Coastline Mask.
Can anyone give me the necessary steps required to accomplish the following within GRASS GIS.
Please note that I've never used GRASS before.
Regards
Peter Wilson
Grass GIS CAN handle large DEM`s though I am not 100% sure about so huge territory. I can suggest you to divide all territory in subregions and process them separately and later on make mosaic using r.patch
In short, here is how I`d do.
All commands you can either find in GUI or launch writing them in console.
Prepare/Set up location and coordinate system for your desired place, e.g. South Africa
Upload your vector files using v.in.ogr . You can use GUI.
Upload your mask file.
Load uploaded vector file in map view display and right click in map list display and choose - set region from display (or something similar)
Use g.region and set your resolution (res=10) (actually here also you can set region from loaded raster or vector map)
If your mask is in vector format, convert it to raster file using v.to.rast giving any masking value, 1 or 9999 for example. You can use GUI.
Set the mask with r.mask and define previously set value. This is where I suggest to use console but I guess GUI also could work out well.
If you have multiple vector maps (points, lines) with values, you have to join them in one composite vector map using v.patch, but before doing it...
make sure all of them have equal column name where values are stored. If neccessary, for each loaded vector map rename column in which you have your values using v.db.renamecol. Now you can launch v.patch with "copy also attribute table" option so now you have composite vector map altogether which you`ll use for DEM generation.
Now all pre-works are done and continue with r.surf.rst or r.surf.idw or any other algorithm which takes values from specified column in your patched altogether vector map and generates that DEM.
Here you can find some specs about each DEM generation algorythm

GIS with Bing Silverlight and SQL 2008?

I have data that I want to create a GIS type application that will have the typical features of adding and removing layers of different types. What is the best architectural approach?
The data consists of property locations in Eastings and Northings.
I also have ordnance survey data in GML and Shapefiles.
I know this is a very broad question but the subject area also seems very broad to me and I am unsure which direction to go.
I was thinking of using SQL 2008 spatial and Bing Silverlight control to visualise that maps.To do this would I have to convert the eastings and northings to GWS84 geography datatype? But then if I converted the shapefiles to GML and imported all the GML files to sql using GeomFromGML they would be in geometry datatypes. Wouldn’t the two types be incompatible?
Also, should ESRI ArcGIS API for Silverlight
feature in the equation? Is this a good environment to create maps that I can point as SQL sqerver 2008 as the datasource (using a WCF service if necessary)?
Any advice greatly appreciated!
This is something I've done several times, using OS data from SQL Server in both Bing Maps AJAX and Silverlight controls. Some general comments below (in no particular order!):
Don't expect to implement full-blown
GIS functionality using Bing Maps.
Simple querying, retrieval and
display of the data is all fine (+
some simple editing), but after that
you'll be struggling with what can be
achieved in the browser.
All vector shapes supplied to Bing Maps need to be in (geography)
WGS85 coordinates, EPSG:4326.
However, all data will be projected
and displayed using (projected)
Spherical Mercator system, EPSG:3857.
In terms of vector shapes, you can expect to achieve a similar level of performance as you get in the SSMS spatial results tab - that is, (with careful architecture) you can plot up to about 5,000 features on the map at once, zoom / pan around them, click on them to bring up various properties and attributes etc. However, after that you'll find the UI becomes fairly unresponsive (which
I imagine is the reason why the spatial results tabs itself limits you to displaying 5,000 records at once).
If you want to display more features than this, one approach is to rasterize them by projecting them into the EPSG:3857 projection, creating a .PNG/.JPG image file of the features and then cutting that image into tiles according to the Bing Maps quadkey tile numbering system as explained here:
http://msdn.microsoft.com/en-us/library/bb259689.aspx and displaying them as a tilelayer. Tile layers are significantly faster than displaying the equivalent vector shapes, although it means the data is static.
If you do create raster tiles, you can either render them dynamically
or pre-render them to improve performance - i.e. you could set
up a job to render and update the tileset for slowly-changing data
every night/every month etc.
If you're talking about OS Mastermap data, the sheer level of detail
involved means that you need to think more carefully about what
features you want to display, and how you want to display them. Take
greater London, for example, which covers an area about 50km x 40km. To
create raster tiles (each of which are 256px x 256px) at zoom level 19
covering this area you'd need to render and store 1.3 million separate
tiles. If each of those is generated from a database query that takes, say
200ms to run, it's gonna take a looooonggggg time to prepare all your
data. Also, once the files have been generated, you might want to think
about storing them in a DB rather than saving them on a file system.
As for loading the OS data into SQL Server in the first place - there
are several tools that will import either from GML or shapefile into SQL
Server, and handle the projection from EPSG:27700 (Ordnance Survey
National Grid) to WGS84 along the way. Try GDAL/OGR or Safe FME for
starters.
I have a blog at http://alastaira.wordpress.com that has several blog posts that you may find useful describing various aspects of integrating Bing Maps and SQL Server. Particularly, you might want to look at:
http://alastaira.wordpress.com/2011/02/16/loading-ordnance-survey-open-data-into-sql-server-2008/
http://alastaira.wordpress.com/2011/01/23/the-google-maps-bing-maps-spherical-mercator-projection/
http://alastaira.wordpress.com/2011/02/21/using-ogr2ogr-to-convert-reproject-and-load-spatial-data-to-sql-server/