Monday 3 June 2019

qgis - Why do my Shapefiles not align correctly?


First, I'll summarize what I understand so far so please confirm or correct me.




  1. When On-the-Fly is selected a layer is reprojected from that of the layer's CRS to that of the project CRS, if the project CRS has been defined and the layer CRS has been recognized (which apparently is not always the case);




  2. The project CRS can be defined three ways: choose one from a menu, set it to a particular layer's CRS, let it default to a past CRS or a layer CRS.





  3. The layer CRS may be recognized on import (or not). If it's not (or is) the way to configure the the CRS is to save the layer as a shape file and select a CRS when prompted. However, it sounds like if a .qrj file has already been generated this will fail somehow, so we must assure ourselves a .qrj file is not present.




How am I doing so far?


Second: I'm using QGIS 1.8 on a Windows 7 OS.


Let's say two different layers have been saved each with CRS designated as EPSG:2272 (NAD83 / Pennsylvania South (ftUS)) and we start a new project. We select On-the-Fly reprojection and set the project CRS to EPSG:2272. We open both .shp files as layers. They are both files of Philadelphia, (PhilaCopIncsJune302012, PhilaCensusBlocks2012) and the the .prj files respectively are:


 PROJCS["NAD83 / Pennsylvania South  (ftUS)",
GEOGCS["NAD83",DATUM["North_American_Datum_1983",
SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],
TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6269"]],

PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],
UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],
AUTHORITY["EPSG","4269"]],
PROJECTION["Lambert_Conformal_Conic_2SP"],
PARAMETER["standard_parallel_1",40.96666666666667],
PARAMETER["standard_parallel_2",39.93333333333333],
PARAMETER["latitude_of_origin",39.33333333333334],
PARAMETER["central_meridian",-77.75],
PARAMETER["false_easting",1968500],
PARAMETER["false_northing",0],UNIT["US survey

foot",0.3048006096012192,AUTHORITY["EPSG","9003"]],
AXIS["X",EAST],AXIS["Y",NORTH],AUTHORITY["EPSG","2272"]]

and


 PROJCS["NAD83 / Pennsylvania South
(ftUS)",
GEOGCS["NAD83",
DATUM["North_American_Datum_1983",
SPHEROID["GRS
1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],

TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6269"]],
PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],
UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],
AUTHORITY["EPSG","4269"]],
PROJECTION["Lambert_Conformal_Conic_2SP"],
PARAMETER["standard_parallel_1",40.96666666666667],
PARAMETER["standard_parallel_2",39.93333333333333],
PARAMETER["latitude_of_origin",39.33333333333334],
PARAMETER["central_meridian",-77.75],
PARAMETER["false_easting",1968500],

PARAMETER["false_northing",0],
UNIT["US survey foot",0.3048006096012192,AUTHORITY["EPSG","9003"]],
AXIS["X",EAST],AXIS["Y",NORTH],AUTHORITY["EPSG","2272"]]

The CRS found in the PhilaCopIncsJune302012 info document is WGS84 decimal degrees.


The CRS found in the PhilaCensusBlocks2012 XML document is



NAD_1983_StatePlane_Pennsylvania_South_FIPS_3702_Feet



The two layers are far far away from each other. Any ideas why?




Answer



If you want to assign a CRS to a displaced shapefile layer different to the current (false) one, do not Save As ... . This will reproject the data, but keep the displacement.


You should better use Vector -> Data Management Tools -> Define Current Projection. This will let coordinate values untouched, but change .prj and .qpj on disk. To see the change of displacement, you have to move the map a bit to force a redraw. This may be considered as a minor, confusing bug: http://hub.qgis.org/issues/7257


Rightclick -> Set CRS for layer is only working for the current QGIS project by writing the new CRS into the .qgs file, so will also not be what you want.


For the second question: The second file I found at opendataphilly.org, it is correct with EPSG:2272, and alignes well to openlayers plugin Openstreetmap background. If the other (from where?) should be in WGS84, you could add it with that projection to the canvas. By saving or defining it to EPSG:2272 you must have done something wrong.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...