[mapserver-users] Best Practice
Schylberg Lars
lars.schylberg at saabgroup.com
Tue Mar 10 07:50:01 PDT 2015
I would write a bash script that starts with using ogrinfo.
Extract all relevant information from ogrinfo with sed, awk and similar tools.
Print the mapfile content of the fly from the bash script with a lot of printf commands
Quick method in my opinion!
Here is a small extract from an example I did a couple of weeks ago:
#!/bin/sh
#
# Argument parsing depending on your needs.
#
# eg. KML_FILE is set from argument 1
# MAPFILE is argument 2
#
# Process EXTENT for the mapfile
#
shopt -s lastpipe
ogrinfo -ro $KML_FILE -al \
| grep Extent | egrep -o '[0-9.]+' | readarray BBOX
minx=`echo ${BBOX[0]} | tr -d '\n'`
miny=`echo ${BBOX[1]} | tr -d '\n'`
maxx=`echo ${BBOX[2]} | tr -d '\n'`
maxy=`echo ${BBOX[3]} | tr -d '\n'`
#
# Print header part of mapfile
#
printf "MAP\n" > ${MAPFILE}.map
printf " NAME %s\n" "$MAPFILE" >> ${MAPFILE}.map
printf " SIZE 1000 1000\n" >> ${MAPFILE}.map
printf " UNITS dd\n" >> ${MAPFILE}.map
printf " EXTENT %s %s %s %s\n" "${minx} ${miny} ${maxx} ${maxy}" >> ${MAPFILE}.map
….
…and the rest of the mapfile in the same manner.
/Lars S.
From: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of alok mathur
Sent: den 10 mars 2015 12:15
To: mapserver-users at lists.osgeo.org
Subject: [mapserver-users] Best Practice
Hi ,
Could any one suggest me to how to create .map file from KML file. Are any tools available.
My requirement is to take KML file as input create .map file corresponding to that KML and provide changes on map so that it reflects on the fly.
--
Alok Mathur
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20150310/3f8b0d41/attachment.htm>
More information about the MapServer-users
mailing list