We have a requirement to email out a map showing a particular feature in our database. When the query is made to generate the map all it has is a feature id. All the queries I've seen to MapServer/WMS include a BBOX. Is it possible to calculate the BBOX based on the feature id?

The feature id will be stored in a PostGIS/PostgreSQL database.

  • can your client access the database directly? – Ian Turton Aug 10 '19 at 15:06
  • Its possible but I was trying to do it with just one query. – Tommie Jones Aug 10 '19 at 19:06
  • You can use a WFS call to GetFeatureById – nmtoken Aug 11 '19 at 17:38
  • All WMS GetMap requests require a BBOX, with extents specified in the coordinate reference system of the request data. That's not specific to a MapServer WMS. Any BBOX can be specified, it doesn't have to match the extent of the feature (but if if it doesn't coincide, you'll get no map image) – nmtoken Aug 12 '19 at 9:20

Neither the WMS protocol nor any of the other MapServer APIs have a mechanism to automatically set the map position and zoom level based on a geometry object.

You have to retrieve the bounding box with a separate query (through WFS, or directly to the database).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.