I want to have the names of the polygons of kml file, displayed in google earth.
I converted the kml file from a shapefile in qgis. The kml file is loaded normally, i can see the name and the description in the list on the google earth panel. I cannot see it on the map though. How can I visualize the names?
I know that i can create a second kml file with points and have those displayed but I need to have one single file for all.
How could I do that?
Thank you
If you don't want to use a 2nd KML file for the centroid points + labels, then you can take your original KML file, wrap each polygon in a MultiGeometry tag, and add the polygon's centroid Point feature into each MuiltiGeometry. Then you can have the labels on those points, and have them be part of the same file as the polygons. Unfortunately I don't know of any easy way to create such a thing in QGIS, so you're probably left with hand-editing or programatically generating the KML.
Related
Requirement:
I have to read dxf files entities which can be 2D building dimensions or road etc. Then i have to place it over the map and return the coordinates just like labs.mapbox.com export the coordinates as geojson like the data below export by labs.mapbox.
Approch: For now i'm using python 'exdxf' package to read dxf file which return me entities information e.g in case of line it would be start/end points. Then i was thinking to draw those entities over a canvas (not sure) then place it over mapbox and get the coordinates where canvas is place export geojson of it is the final goal.
Required help in: Suggest me the right way to achieve this solution, i am open to choose any framework / language.
Thanks for your time
If you've got a dxf file and want to export it as a geosjon file, using ezdxf python package is good but you have to do a lot of processing the dxf entities and stuff and it takes time to achieve what you want.
I suggest using ogr2ogr since this is a time saving approach. it is a library for working with geospatial data and you can convert data to different formats such as Geojson, shapefile and others.
you can easily convert your dxf file to a geojson file with :
ogr2ogr -f Geojson GEOJSON_FILE_NAME YOUR_DXF_FILE_NAME
I suggest reading the documentation
first to get to know about this library and all the options it gives you for processing the data.
I have a contour map that is provided to me by a private company. it comes in the form of a .dwg that works for autocad. In the past i have gotten contour data from usgs but the data provided to me is much more accurate. I want these contours in the .dwg to get loaded into arcmap so I can use them to delineate watersheds as per usual procedure.
Try to open .dwg file from ArcMap's add data option, locate the .dwg file, double click on it and it will show you it's sub-files, open Polyline file or any other file from it as u desire.
Then you can create its boundary and DEM to carry out your tasks.
I am trying to:
Generate a KML file that stores the coordinates of each boundary zone region of London tube map.
Store x,y coordinates as key-pair values to store points of each station on each line.
A KML eventually would look like this:
<nameOfLine>
<zoneNumber>
<zoneregionCoords>
<stationName>
<xCoords></xCoords>
<yCoords></yCoords>
</stationName>
</zoneregionCoords>
</zoneNumber>
</nameOfLine>
Is there a tool to trace the region coordinates of mouse movements (read) from the GIF file onto a KML file? Is there a way I can specifiy the element tags at the same time in the KML file?
The whole objective is to generate this KML file with minimal code.
I am going to use Processing after I have generated the KML file, to give visualization for data to be displayed on the London tube map.gif file.
You can use a tool such as Plot Digitizer to record the coordinates of mouse clicks, then process the final coordinate list with another tool to create a KML.
Alternatively you could create an image overlay in Google Earth using that GIF, align it, then use Google Earth to create the points.
I would like to extract the coordinates (latitude, longitude) and some properties like name and colour of Autocad files. I may do this from a Java program.
From Autocad, which is the right format to export to so I can programmatically parse the file, look for objects and get their properties? (coordinates, name, colour...)
I know Autocad DWG format is a propietary binary file that changes its format every 3 years, so I need to find a file format to export to that allow me to read it easily.
Thanks!
DXF is what you're looking for. It's a documented format for drawing exchange in plain text.
http://images.autodesk.com/adsk/files/acad_dxf0.pdf
DXF is definitely the best format if you're not using a vertical product like Civil or Map. Some vertical products can also export SHP/SHX (shape) files.
Here's references for DXF: http://en.wikipedia.org/wiki/AutoCAD_DXF, http://images.autodesk.com/adsk/files/acad_dxf0.pdf
Here's a SHP reference: http://en.wikipedia.org/wiki/Shapefile
I have a project using various members of Wikipedia's grey maps: http://en.wikipedia.org/wiki/Wikipedia:Blank_maps. I fill them in with colors depending on which countries, states or provinces a user selects by clicking on the shape or by checking a checkbox.
I would like to write a script that creates imagemaps automatically of each country, state or province by somehow getting the X and Y pixel location of the borders of a country, state or province albeit without the names of these entities, which I will fill in later. I have already done the World map by hand and found a open source US map image map demo. I would now like to create my maps more rapidly.
I use PHP and GD to floodfill the shapes, so I guess I could use one central pixel location of the shapes as well. Any suggestions? This script is a possibility but is still somewhat manual: http://abhinavsingh.com/blog/2009/03/using-image-maps-in-javascript-a-demo-application/. Also Mapedit, http://www.boutell.com/mapedit/, has a magic wand feature that works pretty well, but again I have a feeling this can be done automatically.
An almost perfect solution to this issue is by using SVG images and this translator of the svg code to imagmap area tags: http://www.electricfairground.com/polygonator/. The result is an appropriate image map, although the svg image may need to be resized, and the countries or provinces all seem to be offset and occasionally jumbled up. So this require opening a page generated with the SVG image or exported PNG copy of the SVG file, in a wysiwig editor that allows you to move imagemap elements.
I'm trying to figure out what the pattern of the offset is and if I do I'll post it here: http://wherehaveibeen.info/images/polye.html. The author of the "Polygonator" clued me into his service and using svg map images from his article here: http://www.electricfairground.com/2009/08/08/image-map-rollover-effects-using-jquerys-maphilight-plugin/. He advocates there, the tracing of png images into svg images via Inkscape. But since Wikipedia already has maps in SVG format, why not go straight to the code? It turns out that svg files basically already have the polygons separated and the border regions speciied, at least in the Wikipedia grey maps, http://en.wikipedia.org/wiki/Wikipedia:Blank_maps, they just need some cleaning up with the Polygonator.
I found if I opened up the SVG code in Notepad++ i could copy and paste in the entire contents of the SVG file and the polygonator will remove the unneeded code. A little clean up of the imagemap area tags is required afterwards but not much. The biggest problem is the mentioned generated area tags regions offests and the occasionl jumbled up overlapping locations of the imagemap areas in the generated code.
Well the real answer here appears to be that SVG files are almost imagemaps already and can be mildly processed to turn them into imagemaps, and Wikipedia certainly has plenty of SVG maps.
There are at least three projects that attempt to do this, with only some success at the moment. I'm kind of more interested in making an SVG file processing online image mapper service now that so might work on that project instead of just the map coloring one:
Polygonator - described here: http://www.electricfairground.com/2009/08/08/image-map-rollover-effects-using-jquerys-maphilight-plugin/ but the actual service is here: http://www.electricfairground.com/polygonator/index.html - is the simplest and best service or software so far I think. You have to manually dump the SVG XML text into the input field, but despite what the author says, I think you can dump the entire SVG file in the in field, not just the "M-z tag". The resulting area tags need editing to remove empty ones without coordinates and polygons with only two points.
Inkscapemap - http://sourceforge.net/projects/inkscapemap/ - chokes on complex SVG files such as those with shading. Also I couldn't get it to display as an HTML service even though I followed advice about using the main class of the jar file which I found described in the manifest file as well referring to the main jar file and the support file in an "archive" attribute.
http://davidlynch.org/blog/2008/03/creating-an-image-map-from-svg/ - very interesting project with many blog comments. The image maps again are not quite perfect and need editing.
I see I can use GD PHP's imagecolorat and cycle through all the pixels to find those that are black. This works:
<?php
$im = ImageCreateFromPNG("india.png");
$width = imagesx($im);
$height = imagesy($im);
for ($cy=0;$cy<$height;$cy++) {
echo '<p>';
for ($cx=0;$cx<$width;$cx++) {
$rgb = ImageColorAt($im, $cx, $cy);
$col = imagecolorsforindex($im, $rgb);
if ($col["red"] == 0 && $col["green"] == 0 && $col["blue"] ==0){
echo $cx.", ".$cy." ";
} else {echo "";}
}
}
?>
Can anybody suggest how to find the polygons in the huge multipolygon complex that results from running the above code on say a black and white 2 color map of India, where all the borders are black and the interior of the states and Indian Ocean is white??
Here is image of India: http://wherehaveibeen.info/images/india.png and the mess now of the coordinates for the imagemap that needs to be split up into separate polygons: http://wherehaveibeen.info/images/black.php