The shapefile in question does not define an axis order:
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
As a result, GeoTools picks the order of international standards, which is
lat/lon. However, shapefiles are normally encoded lon/lat...
Add this at the beginning of the file to force a "east/north" order:
System.setProperty("org.geotools.referencing.forceXY", "true");
The shapefile reader internal code should probably be forcing this order by
default... although
care should be taken for those prj that do define an axis order. Needs some
research, not a 5 minutes change.
Cheers
Andrea
On Tue, Jun 6, 2017 at 7:53 PM, Ahmed Eldawy <[email protected]>
wrote:
> Hi all,
>
> I am new to GeoTools. I was trying to load a file that represents all US
> states downloaded from here.
> http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/
> 110m/cultural/ne_110m_admin_1_states_provinces.zip
> and the following GeoTIFF file
> http://commondatastorage.googleapis.com/earthenginepartners-hansen/
> GFC2013/Hansen_GFC2013_treecover2000_00N_000E.tif
>
> I also use the ImageLab example from GeoTools website to load the two
> files.
> http://docs.geotools.org/stable/tutorials/_downloads/ImageLab.java
>
> I use getools 17.0
>
> What happens is that the shapefile is rotated 90 degrees. The same files
> are loaded correctly in QGIS. It happens with other files as well that are
> also loaded correctly in QGIS.
>
> When I investigate the problem closely, I found that both files are loaded
> correctly. However, when the Shapefile is projected to the
> CoordinateReferenceSystem of the GeoTIFF file, the latitudes and longitudes
> are exchanged. This results in incorrect results when they are combined.
> Can you provide any help in why this problem happens and how I can solve it?
>
> Best regards,
> Ahmed Eldawy
>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> GeoTools-GT2-Users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
--
==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.
==
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
*AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*
Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.
The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.
-------------------------------------------------------
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users