[mapserver-users] Fwd: Zoom to something and display in one shot from MapServer CGI.

Stephen Woodbridge woodbri at swoodbridge.com
Tue Jul 11 11:06:32 PDT 2017


Bobb,

If you using sql you can do this in one pass, just write a trivial php 
script that returns an image.

1. connect to db
2. sql to query expanded bbox of parcel
    select st_astext(st_extent(st_expand(geom, delta)))
      from parcels where pin=?
3. create url to mapserver based on bbox and image size
5. header('Content-type: image/png');
4. passthru(url);

Don't make it more complicated than it needs to be. You can do the same 
using perl, python, script language of your choice.

-Steve

On 7/11/2017 12:22 PM, Basques, Bob (CI-StPaul) wrote:
> 
>>
>> Hi Steve,
>>
>> I want to send a CGI request like :  ServerName?pin=202923230045
>>
>> And zoom to the pin (parcel polygon) in the returned image and also 
>> add a buffer percentage.  This is for a reporting application.  I can 
>> do it with an intermediate service, but it’s been awhile since I did 
>> this, and was wondering if anything new in MapServer might help with 
>> this for a single pass approach.
>>
>> The zoom parameters would be hardcoded into the MapFILE in an ideal 
>> world, I can build an SQL for this for example, but I recall I 
>> couldn’t use the BBOX returned from the SQL as a BBOX for Mapserver 
>> parent call, my memory is cloudy on that capability from MapServer 
>> though, hence the question.  Now that you have me talking it through 
>> though, I think the last time I asked about this it was to inquire 
>> about possibly chaining more than one MapServer call together to get 
>> the result.  I think there were fears at the time about possible 
>> runaway processes being created . . . .
>>
>> bobb
>>
>>
>>> On Jul 11, 2017, at 10:38 AM, Stephen Woodbridge 
>>> <woodbri at swoodbridge.com <mailto:woodbri at swoodbridge.com>> wrote:
>>>
>>> On 7/11/2017 10:39 AM, Basques, Bob (CI-StPaul) wrote:
>>>> All,
>>>> It’s probably because it’s Tues. but I think I’ve asked this before 
>>>> in the past . . .
>>>> I have a DB with PIN numbers for PARCELS and I want to be able to 
>>>> auto-zoom(with buffer)  to a PARCEL by just sending in a PIN number 
>>>> via CGI.
>>>> can the BBOX be pulled from the DB based on the geom in one shot? 
>>>>  I’ve done this in the past with a Webservice that went and grabbed 
>>>> the BBOX separately, then assembled the url for getting the graphic 
>>>> back from Mapserver.
>>>
>>> Bobb,
>>>
>>> What are you trying to zoom? the image or the client?
>>>
>>> If it is the client then how is mapserver on the server supposed to 
>>> tell the client it needs to zoom? You have to query the server to get 
>>> the bbox then make the client zoom appropriately.
>>>
>>> For the image, assuming you want a static image showing the parcel, 
>>> then I would write a php/python/perl script the you pass the PIN to 
>>> and it does the work to figure out the extents and return the image.
>>>
>>> -Steve W
>>>
>>> ---
>>> This email has been checked for viruses by Avast antivirus software.
>>> https://www.avast.com/antivirus
>>>
>>> _______________________________________________
>>> mapserver-users mailing list
>>> mapserver-users at lists.osgeo.org <mailto:mapserver-users at lists.osgeo.org>
>>> https://lists.osgeo.org/mailman/listinfo/mapserver-users
>>
>>
>> "If you're going through hell, keep going. “
>> - Winston Churchill
>>
>>
> 
> 
> 
> "Be nice to people on your way up because you meet them on your way down."
>     - Jimmy Durante
> 
> 
> 
> 
> 
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-users
> 




More information about the MapServer-users mailing list