Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Perl Mapping (GIS)

by johnfl68 (Beadle)
on Nov 13, 2018 at 03:53 UTC ( #1225681=perlquestion: print w/replies, xml ) Need Help??

johnfl68 has asked for the wisdom of the Perl Monks concerning the following question:

Hello:

I looked around, but did not really see any posts of this nature here, so I don't know if anyone here can help. But it doesn't hurt to ask.

I'm looking for a Perl based mapping (GIS) solution. I need to merge a base map (Natural Earth), and overlay map, and some vector shape files. Nothing too difficult, but may be some different map projections in the merge.

I see Mapserver, but that doesn't look to be too Perl friendly. Same goes for TillMill. Are there any other Linux (Ubuntu 18.04 server) and Perl friendly options out there that I haven't found yet?

If anyone has any suggestions, please let me know.

Thank you as always!

Replies are listed 'Best First'.
Re: Perl Mapping (GIS)
by swl (Deacon) on Nov 13, 2018 at 05:46 UTC

    If it is non-graphical then have a look at Geo::GDAL::FFI for wrangling geospatial data. I know Ari Jolma was also developing a perl/gtk2 GIS tool a while ago, but I'm not sure if it still works under recent versions of its dependencies. Look for geoinformatica at https://github.com/ajolma?tab=repositories.

Re: Perl Mapping (GIS)
by localshop (Monk) on Nov 13, 2018 at 20:19 UTC
    My quick 2 cents - A lot depends on the sort of data you have to play with and where you want to do the processing ( In memory, DB or front-end ) Here's a few spots that you should explore if you haven't already:

    Don't feel like you have to go with a platform - DB+A few Tools+A front end+Some Perl Glue can be a powerful combo without getting locked into a heavy opinionated application platform.

Re: Perl Mapping (GIS)
by bliako (Vicar) on Nov 14, 2018 at 10:43 UTC

    As amateur and newbie to GIS: I wanted to superimpose data from OpenStreetMap (roads) onto an image made from tiles downloaded from one of the free satellite earth images sites (zoom earth).

    QGIS which is free helped me to transform my image in order for it to correspond to correct lat/lon coordinates using 3 landmarks with known lat/lon coordinates. "transform" is more complex than mere scale/translate: the image needs to be warped onto a known coordinate system which allows for expressing the earth's curvature.

    All that using a GUI and a plugin ... maybe another plugin could be written for automating the procedure further. But one needs to interact with the input image in order to identify visually the correspondence points. E.g. you know that a given roundabout in an avenue has so-and-so coordinates. You need to visually identify that roundabout in your image. Nobody can do that for you unless you develop image analysis software to do that for known structures... Maybe there is another way unknown to me but that looks like a challenge.

    Once my satellite view of my city was mapped on coordinates, I used Geo::ShapeFile::Shape in order to read the shape of each road (downloaded from OpenStreetMap) as a sequence of lat/lon control points and draw them onto the image using Graphics::Magick. The result was accurate enough for my eyes.

    That's my minimal (and amateur) experience (and I hate geodesimetry btw).

Re: Perl Mapping (GIS)
by johnfl68 (Beadle) on Nov 15, 2018 at 04:00 UTC

    Thanks everyone for the suggestions!

    Right now I am testing sort of a hybrid solution, building static layers with QGIS on PC and uploading to server (these rarely need to change). And then doing a mix of GDAL and ImageMagick for the real time merges.

    This mostly works for what I need. I am going to look through some of the other suggestions as well. Trying to find a good mix to keep server loads down.

      If you are looking to host your own tiles you might want to start with some base ones from OSM. I can confirm that the bundled script in Geo-OSM-Tiles works but there are plenty of other non-perl alternatives as described at The OSM Wiki page Category:Tile_downloading

      downloadosmtiles.pl --lat=-27.919123 --lon=153.386257 --zoom=13:14

      Using Openlayers you can do a lot of the transforms and adding image layer and vector rendering quite nicely in the browser directly and the downloaded tiles are neatly packaged ready to be served and consumed by OpenLayers. NB - if I remember correctly there are a few little tweaks to get the tile file format pattern correct but is not complex and works really well.

      One of the things I remember surprising me when I was playing with this stuff is that it's almost trivial to transform location formats which can be a reason people jump into dependence on a backend geo application server.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1225681]
Approved by marto
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2019-11-13 20:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (74 votes). Check out past polls.

    Notices?