Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Plotting Software

Options
  • 30-07-2010 5:09pm
    #1
    Registered Users Posts: 13,746 ✭✭✭✭


    Looking to plot a few thousand points on a map of Ireland and it's surrounding areas.

    Google has a limit of 1000 points so that can't help me.

    The points will be co ordinated so it wont look like a blur

    anybody know of free plotting software that will read in a text file of latitude and longitude points and plot them?


Comments

  • Registered Users Posts: 180 ✭✭Darkphenom


    Misticles wrote: »
    Looking to plot a few thousand points on a map of Ireland and it's surrounding areas.

    Google has a limit of 1000 points so that can't help me.

    The points will be co ordinated so it wont look like a blur

    anybody know of free plotting software that will read in a text file of latitude and longitude points and plot them?


    Let me know if you find anything. I think software like that could be useful.
    I might even have a go at making something like that myself!


  • Registered Users Posts: 339 ✭✭duffman85


    You could do this with OpenLayers(like Google Maps API).I've used it here with maps from OpenStreetMap
    Have a look at this example:POI example

    Basically you make up text file delimited by tabs which contains the latitude,longitude,title and description for each marker.
    There is a sample text file and details here:http://dev.openlayers.org/releases/OpenLayers-2.6/doc/apidocs/files/OpenLayers/Layer/Text-js.html.

    You can pretty much copy and paste my code/POI Example and save as a .html file(webpage).
    you just need to change the centre point of the map and the zoom level.

    This is it with about 4,300 points.
    122209.PNG
    This takes about 15s to load.I tried this with google maps and it crashed Firefox.

    This is the HTML and JavaScript for the screenshot above.
    [PHP]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;
    <html>
    <head>
    <style type="text/css">
    html { height: 100% }
    body { height: 100%; margin: 0px; padding: 0px }
    #map_canvas { height:100%;width:80%;float:left; }
    </style>
    <script src="http://www.openlayers.org/api/OpenLayers.js"></script&gt;
    <script type="text/javascript">
    function init() {
    map = new OpenLayers.Map("map_canvas");
    map.addLayer(new OpenLayers.Layer.OSM());
    //point to centre the map on
    var lonLat = new OpenLayers.LonLat(-6.267845611572273,53.346652484299405)
    .transform(
    new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984
    map.getProjectionObject() // to Spherical Mercator Projection
    );

    var zoom=12;
    var pois = new OpenLayers.Layer.Text( "My Points",
    { location:"./points.txt",
    projection: map.displayProjection
    });
    map.addLayer(pois);
    map.setCenter(lonLat, zoom);
    }
    </script>
    </head>
    <body onload="init();">
    <div id="map_canvas"></div>

    </body>
    </html>[/PHP]


  • Registered Users Posts: 1,228 ✭✭✭carveone


    Wow! I was going to suggest amalgamating points at a particular zoom level.

    It's trivial to convert lat/lon coords into KML (which is what google maps will read) but that gives you too many points. At a particular zoom level you could calculate the distance between points and if they were closer than x miles, amalgamate them together into one blob. I was going to try this in awk, which is probably not the language to do it in but what the hey...

    But I think you just got everything you need! That's an impressive post duffman85. Gonna save that post for later :)


  • Registered Users Posts: 339 ✭✭duffman85


    @carveone - Thanks

    I was trying to figure out OpenLayers and was playing around with it.

    Came across the Text layer that takes a text file of points as a parameter, so i posted it up.


  • Registered Users Posts: 13,746 ✭✭✭✭Misticles


    I tried using this but out of about 4000 points, it only plotted one :(


  • Advertisement
  • Registered Users Posts: 339 ✭✭duffman85


    Misticles wrote: »
    I tried using this but out of about 4000 points, it only plotted one :(

    Does the text file look like this:
    lat  lon title   description 
    10   20  title   description
    15   30  title2  description2
    
    The first row is the column titles.

    Is the text file in the same directory as the webpage?
    Is it delimited by tab spaces?

    Where is the one point?
    I found if I did not have the .transform(...); part below that all my points mapped to the same point in the atlantic ocean just south of the Ghana and Ivory Coast which turns out to be N 0°00'00 , E 0°00'00
    This code needs to be in one single line.
     var lonLat = new OpenLayers.LonLat(-6.267845611572273,53.346652484299405).transform(new OpenLayers.Projection("EPSG:4326"),map.getProjectionObject());
    //transform from WGS 1984 to Spherical Mercator Projection
    


  • Registered Users Posts: 13,746 ✭✭✭✭Misticles


    phew, it plotted them all..
    Having difficult viewing it on my laptop..

    I have to zoom in to see the spread but as there are sooo many points they're going off my screen.

    Is there anyway of seeing it without compromising the information?

    and why does Germany appear when it opens? :O


  • Registered Users Posts: 339 ✭✭duffman85


    Misticles wrote: »
    phew, it plotted them all..
    Having difficult viewing it on my laptop..

    I have to zoom in to see the spread but as there are sooo many points they're going off my screen.

    Is there anyway of seeing it without compromising the information?

    and why does Germany appear when it opens? :O

    Not sure what you mean. too many points even when zoomed in?
    You could have several layers but this might be tricky.

    Example of multiple layers and a built in layer switcher.
    If you break up your map into areas - creating a points file and text layer for each and use the layer switcher control to turn on one layer at a time,you might cut out locations where there's overlap. View the source of the layer switcher example above to get an idea how to do this.

    The map should centre on what ever point you set it to.
    in the map.setCenter() line.I used E -6.267845611572273, N 53.346652484299405(Dublin City Centre).


  • Registered Users Posts: 13,746 ✭✭✭✭Misticles


    I have to "try" and analyse burts over the sea Vs over land!!
    Any idea what I could use to distinguish this?
    Using Lat Longs


  • Registered Users Posts: 1,228 ✭✭✭carveone


    Distinguishing land from sea can be done with topography information - ie: altitude. The US GIS provides data for the US but, staggeringly, one of the shuttle missions did data topography of the planet which is free to the public.

    (rant)
    I assume the Irish and UK GIS surveys are paid for by the public but they aren't available to the public. Nice of them. The US data has always generated significant business opportunity that the governments here feel they can do without.
    (end rant)

    This data is used all over the place now. In flight sims too.

    Anyway. Check out the wikipedia entry for "SRTM Water Body Data". There may be some web interface to it somewhere where you can submit a long/lat and get back "water/land".

    Doing it yourself from the shapefile data might be a PhD in itself :-)


  • Advertisement
  • Registered Users Posts: 339 ✭✭duffman85


    I came across this http://www.gadm.org/country.
    You can download the outline of Ireland in ShapeFile,Arc Geodatabase,Google Earth or R (a stats package) formats.
    If you are using a GIS like ArcView you should be able to do a 'select everything inside this polygon(Ireland's Boundary)' spatial query.

    One caveat though:
    This dataset is freely available for academic and other non-commercial use. Redistribution, or commercial use, is not allowed without prior permission.


  • Registered Users Posts: 1,228 ✭✭✭carveone


    There's always a caveat. I found a few webservices that use the SRTM data but one has a caveat for non-commercial use... must pay...etc.etc. That's at http://www.earthtools.org/. The other at geonames has a lot of web service interfaces, including XML and, rather nicely, JSON. It's a REST interface.

    Eg:

    http://ws.geonames.org/srtm3XML?lat=52.683&lng=-9.0143

    Gives 0 for the height indicating the sea. Well. Coast. The oceans return -32768 but the concept of ocean seems to be at least x miles away from the coast. No real idea why that is. Still. Less than or equal to zero seems like a reasonable test for "the sea"...

    There is a caveat and that is a limit on requests per hour/day. 4000 points would cause an issue. The day limit on geonames is like 30000 points so, if you delay a bit between requests you could plot everything.

    Misticles, you'll need to download a program called "curl" from http://curl.haxx.se/download.html. Curl fetches from URLs. Using this one can script requests over time that will say "ocean" or "land" for all your points of interest.


Advertisement