[mapserver-users] Integration and extent ..............

José María Michia jose.maria.michia at gmail.com
Thu Dec 11 06:45:34 PST 2008


> Hi,,
>
>   How I will get raster data with lat long extent (free)? I have one map
> appilication which I wrote in php mapscript.And I have also one jsp
> application. Now I want to integratefirst one with tomcat(2nd one).
> Actually what I done ....I simple created a hyperlink from my jsp page to
> map application. If I run tomcat and used that link it works fine.jsp
> application as well as mapscript application. Mapserver is cgi based.....and
> tomcat????????(using diff port)   Please anybody can explain why it is
> working fine................

Sorry, I cannot fully understand this part of your message (maybe
because my poor english).

> Please tell me how I will get the lat long extent from pixel extent(like
> 0,0,234,345) .....I think it is not possible at all....................But I
> want to be sure..........
> Plz reply me soon............................I am  very new mapserver
> user............................plz help me ..................

Is possibly to convert image coordinates to geographic coordinates.
Almost with some scripting.

This python code maybe useful:

# convert image coordinates (xy in pixel)  to geographic coordinates
(in map projection)
def MapPix2Geo(nPix, map):
   n_pointc= mapscript.pointObj()
   dfDeltaX = map.extent.maxx-map.extent.minx
   dfDeltaY = map.extent.maxy-map.extent.miny
   n_pointc.x= map.extent.minx + (nPix.x*dfDeltaX)/map.width
   n_pointc.y= map.extent.miny + ((map.height-nPix.y)*dfDeltaY)/map.height
   return n_pointc

If map projection is other than lat-lon, you need one more conversion:

# convert coordinates from map projection (planar xy)  to geographic
coordinates (lat lon)

def convertToLL(nP, map):
  p1 = pyproj.Proj(map.getProjection())
  p2 = Proj(init='epsg:4326')
  result = pyproj.transform(p1,p2,nP.x,nP.y)
  return result

Suerte y saludos
José María

> Thanks.............
>
>
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
>



More information about the MapServer-users mailing list