How to change Layer's Native Projection

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How to change Layer's Native Projection

Mustafa646
I have a Layer (polygon shapefile) with native projection EPSG:3008. I want to change its native projection from EPSG:3008 to EPSG:4326. How i do this ?

I don't want to change it using third party tool like ogr2ogr. I want to change it using Proj4 js library. How i do this ?



Reply | Threaded
Open this post in threaded view
|

Re: How to change Layer's Native Projection

Frank Warmerdam
On 11-08-10 07:43 AM, Mustafa646 wrote:
> I have a Layer (polygon shapefile) with native projection EPSG:3008. I want
> to change its native projection from EPSG:3008 to EPSG:4326. How i do this ?
>
> I don't want to change it using third party tool like ogr2ogr. I want to
> change it using Proj4 js library. How i do this ?

Mustafa,

PROJ.4 does not include any support for accessing feature formats like
shapefiles.  You could convert a stream of text points from one coordinate
system to the other like:

   cs2cs +init=epsg:3008 +to +init=epsg:4326 < 3008.txt > 4326.txt

I shall avoid asking why you wish to avoid ogr2ogr despite my curiosity.

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, [hidden email]
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj
Reply | Threaded
Open this post in threaded view
|

Re: How to change Layer's Native Projection

support.mn
In reply to this post by Mustafa646
Hello,

Commercial MNS can import shp files in any (EPSG) projection and export them
to any (EPSG) projection. If you want to do the programming your self you might
start your project from "shp2text"

http://www.obviously.com/gis/shp2text/

which is very close all what is needed additional to Proj.4. Shp2text is based on
"shapelib":

http://shapelib.maptools.org/

Shapelib author Frank Warmerdam knows more about that library I am sure ;)

And he might tell you how "easy" it is to be integrated with Java if that is what
you want? Most of proj.4 etc. is written in C.

Regards: Janne.

---------------------------------------------------

Mustafa646 [[hidden email]] kirjoitti:
> I have a Layer (polygon shapefile) with native projection EPSG:3008. I want
> to change its native projection from EPSG:3008 to EPSG:4326. How i do this ?
>
> I don't want to change it using third party tool like ogr2ogr. I want to
> change it using Proj4 js library. How i do this ?
>

_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj
Reply | Threaded
Open this post in threaded view
|

Re: How to change Layer's Native Projection

Frank Warmerdam
In reply to this post by Mustafa646
On Wed, Aug 10, 2011 at 7:43 AM, Mustafa646 <[hidden email]> wrote:
> I don't want to change it using third party tool like ogr2ogr. I want to
> change it using Proj4 js library. How i do this ?

Hi,

I'm afraid I missed the "js" part of the above when
replying last time.  My answer was around the C version
of PROJ.4, not the JavaScript version.  The JavaScript
version also does not have built-in shapefile support and
I'm not sure how you would go about reading and writing
shapefiles in JavaScript.

I do believe that Proj4JS does not use init files so you
might need to provide the full parameters for the
coordinate systems in question.  For EPSG:3008 that
might look something like:

+proj=tmerc +lat_0=0 +lon_0=13.5 +k=1 +x_0=150000 +y_0=0 +ellps=GRS80

Take my javascript advice with a grain of salt.

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, [hidden email]
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Software Developer
_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj