[mapserver-users] Reporting lat/long from projected map units

Milo van der Linden milo at dogodigi.net
Thu Jan 13 15:27:45 EST 2011


You're welcome!

2011/1/13 Bistrais, Bob <Bob.Bistrais at maine.gov>

>  Got it now- I forgot to put in a script tag for the projection
> definitions.
>
> Seems to be working now.
>
>
>
> Thanks Milo!
>
>
>  ------------------------------
>
> *From:* Milo van der Linden [mailto:milo at dogodigi.net]
> *Sent:* Thursday, January 13, 2011 11:09 AM
> *To:* Bistrais, Bob
> *Cc:* mapserver-users
>
> *Subject:* Re: [mapserver-users] Reporting lat/long from projected map
> units
>
>
>
> Mmm, that shouldn't be to hard. Let me try;
>
> var source = new Proj4js.Proj(‘EPSG:YOUR_UTM_EPSGCODE’);
>
> var dest = new Proj4js.Proj(‘EPSG:4326’); . . .
>
>
> // transforming point coordinates
>
> var p = new Proj4js.Point(YOUR_UTM_X,YOUR_UTM_Y);
>
> Proj4js.transform(source, dest, p);
>
>
> alert(p.x); //WILL ALERT YOUR NEW LON
>
> alert(p.y); //WILL ALERT YOUR NEW LAT
>
>
>
> 2011/1/13 Bistrais, Bob <Bob.Bistrais at maine.gov>
>
> I downloaded the code and am looking at the Wiki.  I don’t see anything to
> input screen or UTM coords.  Is it in the code somewhere?
>
>
>  ------------------------------
>
> *From:* Milo van der Linden [mailto:milo at dogodigi.net]
> *Sent:* Wednesday, January 12, 2011 12:44 PM
> *To:* mapserver-users
>
>
> *Subject:* Re: [mapserver-users] Reporting lat/long from projected map
> units
>
>
>
> (Sorry, my last posts went straight to you by accident, I prefer to stay on
> the list, but gmail for applications not always agrees with me)
>
> proj4js has project pages including documentation on the OSGeo wiki. The
> userguide is here:
>
> http://trac.osgeo.org/proj4js/wiki/UserGuide
>
> and it immediately explains what you want
>
> 2011/1/12 Bistrais, Bob <Bob.Bistrais at maine.gov>
>
> Yes, I can get UTM coordinates back.  Can you elaborate a bit on proj4js?
> I’m not familiar with that.
>
>
>  ------------------------------
>
> *From:* Milo van der Linden [mailto:milo at dogodigi.net]
> *Sent:* Wednesday, January 12, 2011 11:10 AM
>
>
> *To:* Bistrais, Bob
> *Subject:* Re: [mapserver-users] Reporting lat/long from projected map
> units
>
>
>
> Well then one question remains:
>
> Are you able to convert screen coords to UTM capturing an onclick event?
> Because then all you need to do is enhance it with proj4js
>
> 2011/1/12 Bistrais, Bob <Bob.Bistrais at maine.gov>
>
> Yes, a web mapping application.  Not using Open Layers.  We are using
> PHP-Mapscript/HTML/JavaScript.  All queryable data is in shapefiles, again,
> all of these are in UTM.
>
>
>  ------------------------------
>
> *From:* Milo van der Linden [mailto:milo at dogodigi.net]
> *Sent:* Wednesday, January 12, 2011 11:03 AM
> *To:* Bistrais, Bob
>
>
> *Subject:* Re: [mapserver-users] Reporting lat/long from projected map
> units
>
>
>
> Are you talking bout a web-app? Do you use a client like OpenLayers? What
> programming language(s) do you use? Is your datasource a database? Like
> postgis?
>
>
>
> If you can get UTM coordinates from the mouseclick, the next best option
> (in my opinion) would be to use proj4js:
>
> http://proj4js.org/
>
> Simply embed the js-library ad an event for mouse handling and convert:
> screen->utm->4326.
>
> 2011/1/12 Bistrais, Bob <Bob.Bistrais at maine.gov>
>
> This should be fairly straightforward, but I was wondering what is the
> easiest and quickest way to convert coordinates on the fly.  All my data is
> in UTM coordinates.  I want to report coordinates to the screen in
> Lat/Long.  Changing the projections on the map files to lat/long (EPSG:4326)
> is not an option, as this will cause problems elsewhere.  So what I want to
> do is take point coordinates, either from a mouse click or from UTM
> coordinates, project to lat/long, which will be reported in a result
> window.  What is the quickest way to do this?
>
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
>
>
>
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20110113/3780e363/attachment.html


More information about the mapserver-users mailing list