Re: [mapserver-users] Photo Viewer
I do this by faking a WMS-service, with the pixel size of the scan as map boundaries, and using an arbitrary EPSG. It's primitive, but it works and I use it a lot, especially for large serieses of scans. See: http://mapserver.sara.nl/atlas/georef.html Left the unreferenced scan, right the referenced maps, both zoomable independently. With a little elementary math, you can even align both maps (the sync buttons). You can even use it in QGIS or any other WMS-enabled program, e.g. to set reference points for warping or designing vector art work. Comments appreciated. Jan (file: utils.inc) ?php function getSizeRaster($data) { //Compute size of raster file $data in array $arr return ($ar); } function createMapFromData($title,$epsg,$parms,$data) $oMap = ms_newMapObj(); $oMap-setProjection(init=epsg:$epsg); $oMap-setMetaData(wms_title,$title); $oMap-setMetaData(wms_srs,epsg:$epsg); $oMap-setMetadata(wms_contactperson,Jan Hartmann); $oMap-setMetadata(wms_contactorganization,University of Amsterdam); $oMap-setMetadata(wms_contactelectronicmailaddress,j.l.h.hartm...@uva.nl); $oMap-setMetadata(wms_enable_request,*); $pwd = http://mapserver.sara.nl/; . $_SERVER[SERVER_NAME]; $pwd = $pwd . $_SERVER[PHP_SELF]; if ($parms) $pwd = $pwd . ?$parms; $oMap-setMetadata(wms_onlineresource,$pwd); $l = ms_newLayerObj($oMap); $l-set(name,$title); $l-setProjection(init=epsg:$epsg); $l-setMetadata(wms_title,$title); $l-setMetadata(wms_srs,epsg:$epsg); $l-set(status,MS_DEFAULT); $l-set(type,MS_LAYER_RASTER); $l-set(data,$data); $ar = getSizeRaster($data); $oMap-setExtent($ar[0],$ar[1],$ar[2],$ar[3]); $oMap-setMetadata(wms_extent,$ar[0] $ar[1] $ar[2] $ar[3]); $l-setMetadata(wms_extent,$ar[0] $ar[1] $ar[2] $ar[3]); $oMap-setSize(600,600 * (($ar[3]-$ar[1]) / ($ar[2] - $ar[0]))); return($oMap); } function dispatchMap($oMap) { $request = ms_newowsrequestobj(); $request-loadparams(); ms_ioinstallstdouttobuffer(); $oMap-owsdispatch($request); $contenttype = ms_iostripstdoutbuffercontenttype(); if ($contenttype == text/xml) { header(Content-type: application/xml); $buffer = ms_iogetstdoutbufferstring(); echo $buffer; } else { header(Content-type:$contenttype); ms_iogetStdoutBufferBytes(); } ms_ioresethandlers(); } ? The simplest WMS-service would be a PHP-script like ?php require(utils.inc); $fn = path to scan-file; $oMap = createMapFromData(WMS_title,28992,,$fn); dispatchMap($oMap); ? The WMS-service would just be: mywms.php When you have a series of numbered scans in subdirectories, you could do: ?php require(utils.inc); $base = base directory of scans; $subdir = $_REQUEST[subdir]; $nr = $_REQUEST[nr]; $path = $base/$subdir/scan_$nr.tif; $oMap = createMapFromData(scan,28992,subdir=$subdirnr=$nr,$path); dispatchMap($oMap); ? And accessl each scan as a WMS service like: mywms.php?subdir=subdirnr=nr On 02/14/2013 05:03 PM, Weisbender, Eric wrote: I would like to use MapServer as just an unreferenced image viewer for jpgs so I can zoom in and out on the image. Everything I read says that images have to be georeferenced. Any idea or even examples would be greatly appreciated. Thanks, Eric Weisbender ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Photo Viewer
I got it to work. Thanks for all your help. Thanks, Eric Weisbender GIS Program Lead Western Area Power Administration Corporate Service Office U.S. Dept. of Energy 12155 W. Alameda Parkway Lakewood, CO office: (720) 962-7280 fax: (720) 962-7269 email: weisb...@wapa.govmailto:weisb...@wapa.gov 39°42'25.06N 105° 8'13.61W [cid:image003.jpg@01CE0B62.0D60C7B0] From: Lime, Steve D (MNIT) [mailto:steve.l...@state.mn.us] Sent: February 14, 2013 3:41 PM To: Basques, Bob (CI-StPaul); Weisbender, Eric; mapserver-users@lists.osgeo.org Subject: RE: Photo Viewer Could try ANGLE 90 at the map level? From: Basques, Bob (CI-StPaul) Sent: Thursday, February 14, 2013 4:17 PM To: Lime, Steve D (MNIT); Weisbender, Eric; mapserver-users@lists.osgeo.orgmailto:mapserver-users@lists.osgeo.org Subject: RE: Photo Viewer Ok, I sort of got something to work . . . http://gis.ci.stpaul.mn.us/datasets/SHP/SAINT_PAUL/PUBLIC_WORKS/TEST/image_pixel_coord_public.map http://gis.ci.stpaul.mn.us/datasets/SHP/SAINT_PAUL/PUBLIC_WORKS/TEST/image_pixel_coord_public.map?mapext=750+600+1100+925 Danged if I can figure out how to rotate the image (via the world file), nothing is happening with edits to the world file. Still not responding to all the CGI parameters either. MAPFILE: MAP NAME PHOTO SIZE 2048 1536 EXTENT 0 0 2048 1536 UNITS feet LAYER NAME photo DATA up_a_tree.jpg TYPE RASTER TRANSFORM FALSE STATUS DEFAULT UNITS PIXELS END END WORLD FILE: 1. 0. 0. 1. 0.5 0.5 bobb From: Lime, Steve D (MNIT) Sent: Thursday, February 14, 2013 10:53 AM To: Basques, Bob (CI-StPaul); Weisbender, Eric; mapserver-users@lists.osgeo.orgmailto:mapserver-users@lists.osgeo.org Subject: RE: Photo Viewer I would think it could be done, your extent would be given in pixels. Full extent is given as 0 0 width-1 height-1. Depends if the raster code respects the layer TRANSFORM parameter. Steve From: mapserver-users-boun...@lists.osgeo.orgmailto:mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Basques, Bob (CI-StPaul) Sent: Thursday, February 14, 2013 10:34 AM To: Weisbender, Eric; mapserver-users@lists.osgeo.orgmailto:mapserver-users@lists.osgeo.org Subject: Re: [mapserver-users] Photo Viewer Eric, Interesting idea. I remember a thread a few years back about something similar being asked. As far as the geo-referencing part, you can simply use the size of the image as your reference coordinate system for each image. Mapserver is more generally suit towards combining different data into a single output, thus the need for a coordinate system to reference more than one layer. So, the real question boils down to a technique for fooling MapServer into some sort of projection some how for each image. Let me think on this a bit. I wonder though about setting up something to register images to a location via a loading form which grabs the image size, etc. Then they are put away with the sudo projection assigned to each image at the uploading point. Bobb From: mapserver-users-boun...@lists.osgeo.orgmailto:mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Weisbender, Eric Sent: Thursday, February 14, 2013 10:03 AM To: mapserver-users@lists.osgeo.orgmailto:mapserver-users@lists.osgeo.org Subject: [mapserver-users] Photo Viewer I would like to use MapServer as just an unreferenced image viewer for jpgs so I can zoom in and out on the image. Everything I read says that images have to be georeferenced. Any idea or even examples would be greatly appreciated. Thanks, Eric Weisbender inline: image003.jpg___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Photo Viewer
I would like to use MapServer as just an unreferenced image viewer for jpgs so I can zoom in and out on the image. Everything I read says that images have to be georeferenced. Any idea or even examples would be greatly appreciated. Thanks, Eric Weisbender ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Photo Viewer
Eric, Interesting idea. I remember a thread a few years back about something similar being asked. As far as the geo-referencing part, you can simply use the size of the image as your reference coordinate system for each image. Mapserver is more generally suit towards combining different data into a single output, thus the need for a coordinate system to reference more than one layer. So, the real question boils down to a technique for fooling MapServer into some sort of projection some how for each image. Let me think on this a bit. I wonder though about setting up something to register images to a location via a loading form which grabs the image size, etc. Then they are put away with the sudo projection assigned to each image at the uploading point. Bobb From: mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Weisbender, Eric Sent: Thursday, February 14, 2013 10:03 AM To: mapserver-users@lists.osgeo.org Subject: [mapserver-users] Photo Viewer I would like to use MapServer as just an unreferenced image viewer for jpgs so I can zoom in and out on the image. Everything I read says that images have to be georeferenced. Any idea or even examples would be greatly appreciated. Thanks, Eric Weisbender ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Photo Viewer
I would think it could be done, your extent would be given in pixels. Full extent is given as 0 0 width-1 height-1. Depends if the raster code respects the layer TRANSFORM parameter. Steve From: mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Basques, Bob (CI-StPaul) Sent: Thursday, February 14, 2013 10:34 AM To: Weisbender, Eric; mapserver-users@lists.osgeo.org Subject: Re: [mapserver-users] Photo Viewer Eric, Interesting idea. I remember a thread a few years back about something similar being asked. As far as the geo-referencing part, you can simply use the size of the image as your reference coordinate system for each image. Mapserver is more generally suit towards combining different data into a single output, thus the need for a coordinate system to reference more than one layer. So, the real question boils down to a technique for fooling MapServer into some sort of projection some how for each image. Let me think on this a bit. I wonder though about setting up something to register images to a location via a loading form which grabs the image size, etc. Then they are put away with the sudo projection assigned to each image at the uploading point. Bobb From: mapserver-users-boun...@lists.osgeo.orgmailto:mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Weisbender, Eric Sent: Thursday, February 14, 2013 10:03 AM To: mapserver-users@lists.osgeo.orgmailto:mapserver-users@lists.osgeo.org Subject: [mapserver-users] Photo Viewer I would like to use MapServer as just an unreferenced image viewer for jpgs so I can zoom in and out on the image. Everything I read says that images have to be georeferenced. Any idea or even examples would be greatly appreciated. Thanks, Eric Weisbender ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Photo Viewer
Ok, I sort of got something to work . . . http://gis.ci.stpaul.mn.us/datasets/SHP/SAINT_PAUL/PUBLIC_WORKS/TEST/image_pixel_coord_public.map http://gis.ci.stpaul.mn.us/datasets/SHP/SAINT_PAUL/PUBLIC_WORKS/TEST/image_pixel_coord_public.map?mapext=750+600+1100+925 Danged if I can figure out how to rotate the image (via the world file), nothing is happening with edits to the world file. Still not responding to all the CGI parameters either. MAPFILE: MAP NAME PHOTO SIZE 2048 1536 EXTENT 0 0 2048 1536 UNITS feet LAYER NAME photo DATA up_a_tree.jpg TYPE RASTER TRANSFORM FALSE STATUS DEFAULT UNITS PIXELS END END WORLD FILE: 1. 0. 0. 1. 0.5 0.5 bobb From: Lime, Steve D (MNIT) Sent: Thursday, February 14, 2013 10:53 AM To: Basques, Bob (CI-StPaul); Weisbender, Eric; mapserver-users@lists.osgeo.org Subject: RE: Photo Viewer I would think it could be done, your extent would be given in pixels. Full extent is given as 0 0 width-1 height-1. Depends if the raster code respects the layer TRANSFORM parameter. Steve From: mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Basques, Bob (CI-StPaul) Sent: Thursday, February 14, 2013 10:34 AM To: Weisbender, Eric; mapserver-users@lists.osgeo.org Subject: Re: [mapserver-users] Photo Viewer Eric, Interesting idea. I remember a thread a few years back about something similar being asked. As far as the geo-referencing part, you can simply use the size of the image as your reference coordinate system for each image. Mapserver is more generally suit towards combining different data into a single output, thus the need for a coordinate system to reference more than one layer. So, the real question boils down to a technique for fooling MapServer into some sort of projection some how for each image. Let me think on this a bit. I wonder though about setting up something to register images to a location via a loading form which grabs the image size, etc. Then they are put away with the sudo projection assigned to each image at the uploading point. Bobb From: mapserver-users-boun...@lists.osgeo.orgmailto:mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Weisbender, Eric Sent: Thursday, February 14, 2013 10:03 AM To: mapserver-users@lists.osgeo.orgmailto:mapserver-users@lists.osgeo.org Subject: [mapserver-users] Photo Viewer I would like to use MapServer as just an unreferenced image viewer for jpgs so I can zoom in and out on the image. Everything I read says that images have to be georeferenced. Any idea or even examples would be greatly appreciated. Thanks, Eric Weisbender ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Photo Viewer
Could try ANGLE 90 at the map level? From: Basques, Bob (CI-StPaul) Sent: Thursday, February 14, 2013 4:17 PM To: Lime, Steve D (MNIT); Weisbender, Eric; mapserver-users@lists.osgeo.org Subject: RE: Photo Viewer Ok, I sort of got something to work . . . http://gis.ci.stpaul.mn.us/datasets/SHP/SAINT_PAUL/PUBLIC_WORKS/TEST/image_pixel_coord_public.map http://gis.ci.stpaul.mn.us/datasets/SHP/SAINT_PAUL/PUBLIC_WORKS/TEST/image_pixel_coord_public.map?mapext=750+600+1100+925 Danged if I can figure out how to rotate the image (via the world file), nothing is happening with edits to the world file. Still not responding to all the CGI parameters either. MAPFILE: MAP NAME PHOTO SIZE 2048 1536 EXTENT 0 0 2048 1536 UNITS feet LAYER NAME photo DATA up_a_tree.jpg TYPE RASTER TRANSFORM FALSE STATUS DEFAULT UNITS PIXELS END END WORLD FILE: 1. 0. 0. 1. 0.5 0.5 bobb From: Lime, Steve D (MNIT) Sent: Thursday, February 14, 2013 10:53 AM To: Basques, Bob (CI-StPaul); Weisbender, Eric; mapserver-users@lists.osgeo.orgmailto:mapserver-users@lists.osgeo.org Subject: RE: Photo Viewer I would think it could be done, your extent would be given in pixels. Full extent is given as 0 0 width-1 height-1. Depends if the raster code respects the layer TRANSFORM parameter. Steve From: mapserver-users-boun...@lists.osgeo.orgmailto:mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Basques, Bob (CI-StPaul) Sent: Thursday, February 14, 2013 10:34 AM To: Weisbender, Eric; mapserver-users@lists.osgeo.orgmailto:mapserver-users@lists.osgeo.org Subject: Re: [mapserver-users] Photo Viewer Eric, Interesting idea. I remember a thread a few years back about something similar being asked. As far as the geo-referencing part, you can simply use the size of the image as your reference coordinate system for each image. Mapserver is more generally suit towards combining different data into a single output, thus the need for a coordinate system to reference more than one layer. So, the real question boils down to a technique for fooling MapServer into some sort of projection some how for each image. Let me think on this a bit. I wonder though about setting up something to register images to a location via a loading form which grabs the image size, etc. Then they are put away with the sudo projection assigned to each image at the uploading point. Bobb From: mapserver-users-boun...@lists.osgeo.orgmailto:mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Weisbender, Eric Sent: Thursday, February 14, 2013 10:03 AM To: mapserver-users@lists.osgeo.orgmailto:mapserver-users@lists.osgeo.org Subject: [mapserver-users] Photo Viewer I would like to use MapServer as just an unreferenced image viewer for jpgs so I can zoom in and out on the image. Everything I read says that images have to be georeferenced. Any idea or even examples would be greatly appreciated. Thanks, Eric Weisbender ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users